digitalmars.D.bugs - [Issue 13632] New: Second argument for std.string.strip
- via Digitalmars-d-bugs (27/30) Oct 18 2014 https://issues.dlang.org/show_bug.cgi?id=13632
https://issues.dlang.org/show_bug.cgi?id=13632 Issue ID: 13632 Summary: Second argument for std.string.strip Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: Phobos Assignee: nobody puremagic.com Reporter: bearophile_hugs eml.cc I suggest to add to std.string.strip a second optional argument as in the Python string method strip: str.strip([chars]) Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped: Examples:'spacious'' spacious '.strip()'data'"xxxdataxx".strip("x")'example' In D you can use a "char pattern" for the second argument. --'www.example.com'.strip('cmowz.')
Oct 18 2014