D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15596 - strip with delimiter?
Summary: strip with delimiter?
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-23 07:52 UTC by Manu
Modified: 2020-03-21 03:56 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Manu 2016-01-23 07:52:05 UTC
std.string.strip() removes whitespace, but the docs make no mention of a version that receives a set of delimiters.
If it exists, it should be documented/linked, if it doesn't, it should probably be added.
Comment 1 basile-z 2016-02-28 03:10:12 UTC
Since std.algorithm.mutation.strip/Left/Right do the job
(http://dlang.org/phobos/std_algorithm_mutation.html#.strip)
I think your report is invalid.
Comment 2 Manu 2016-02-28 05:18:17 UTC
(In reply to b2.temp from comment #1)
> Since std.algorithm.mutation.strip/Left/Right do the job
> (http://dlang.org/phobos/std_algorithm_mutation.html#.strip)
> I think your report is invalid.

"If it exists, it should be documented/linked"
Comment 3 Manu 2016-02-28 05:23:35 UTC
It is so hard to do string manipulation in phobos. Nobody I've encountered yet can find most of the functions, they're scattered among 4, 5, 6? modules. Unless you already know what the function names are, and where they are, how can people find what they want? They do an exhaustive search through a bunch of modules hoping to stumble upon it.

My feeling is that it wouldn't hurt for std.string to alias the hell out of other modules and make all the conventional string operations available in one place.
Comment 4 basile-z 2016-02-28 06:47:43 UTC
(In reply to Manu from comment #3)
> It is so hard to do string manipulation in phobos. Nobody I've encountered
> yet can find most of the functions, they're scattered among 4, 5, 6?
> modules. Unless you already know what the function names are, and where they
> are, how can people find what they want? They do an exhaustive search
> through a bunch of modules hoping to stumble upon it.
> 
> My feeling is that it wouldn't hurt for std.string to alias the hell out of
> other modules and make all the conventional string operations available in
> one place.

I agree, after reading your BR, I've myself done the error to write a popWhile() function using a predicate for my user lib after what I've remembered about algorithm.mutation, but it was too late...

Maybe a note in the std.string doc: "see also: for more generic strip funcyion..."
Comment 5 ag0aep6g 2016-02-28 10:24:39 UTC
(In reply to b2.temp from comment #4)
> Maybe a note in the std.string doc: "see also: for more generic strip
> funcyion..."

Already there: "There is a rich set of functions for string handling defined in other modules. Functions related to Unicode and ASCII are found in std.uni and std.ascii, respectively. Other functions that have a wider generality than just strings can be found in std.algorithm and std.range."
Comment 6 ag0aep6g 2016-02-28 10:26:58 UTC
(In reply to ag0aep6g from comment #5)
> (In reply to b2.temp from comment #4)
> > Maybe a note in the std.string doc: "see also: for more generic strip
> > funcyion..."
> 
> Already there: "There is a rich set of functions for string handling defined
> in other modules. Functions related to Unicode and ASCII are found in
> std.uni and std.ascii, respectively. Other functions that have a wider
> generality than just strings can be found in std.algorithm and std.range."

Whoops, you were talking about strip's docs specifically. Sorry for the noise.
Comment 7 github-bugzilla 2016-02-29 22:26:56 UTC
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/1d7920d38311c94a00389bafaf6299952848317e
fixed issue 15596

https://github.com/D-Programming-Language/phobos/commit/098ce234cff2be2345d7f2f5f7022f74c2566a88
Merge pull request #4029 from BBasile/issue-15596

fixed issue 15596 - mention algorithm.mutation.stripXXX in std.string.stripXXX comments