mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 22:50:38 +03:00

Added second argument similar to Python `str.strip` Second argument accepts a string of characters to strip and strips only those characters. Examples: "xyzhello".stripLeft("xyz") == "hello" "helloxy ".stripRight("xy ") == "hello" "xhellox".strip("x") == "hello" Signed-off-by: Aravinda VK <mail@aravindavk.in>
14 lines
497 B
Text
14 lines
497 B
Text
`std.string.strip` now accepts a string of characters to be stripped
|
|
|
|
New overload functions of $(REF strip, std, string),
|
|
$(REF stripLeft, std, string) and
|
|
$(REF stripRight, std, string) accepts a string of characters to be
|
|
stripped instead of stripping only whitespace.
|
|
|
|
---
|
|
import std.string: stripLeft, stripRight, strip;
|
|
|
|
assert(stripLeft("www.dlang.org", "w.") == "dlang.org");
|
|
assert(stripRight("dlang.org/", "/") == "dlang.org");
|
|
assert(strip("www.dlang.org/", "w./") == "dlang.org");
|
|
---
|