[Issue 18121] Needleless findSplit* methods

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 9 17:38:13 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18121

--- Comment #1 from hsteoh at quickfur.ath.cx ---
Found a similar need for needleless overloads of findSplit* today too. The
context is that I'm trying to tokenize a string, and if it starts with a digit,
say "1234abcd" I'd like to be able to split it into "1234" and "abcd".  So
ideally:

------
auto input = "1234abcd";
auto r = input.findSplitBefore!(ch => !isDigit(ch));
assert(r[0] == "1234" && r[1] == "abcd");
------

The current overloads do not allow this, though.

--


More information about the Digitalmars-d-bugs mailing list