http://d.puremagic.com/issues/show_bug.cgi?id=10933
Summary: findSplitBefore/After should have needle-less
overloads
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Jakob Ovrum <[email protected]> 2013-08-30 23:26:46 PDT
---
`find` has an overload that doesn't take a needle but requires an unary
predicate function. `findSplitBefore` and `findSplitAfter` should have
equivalent overloads.
Test illustrating use:
----
unittest
{
import std.algorithm : findSplitBefore;
import std.uni : isWhite;
import std.string : stripLeft;
immutable tests = [
"prefix postfix lorem ipsum",
"prefix\tpostfix lorem ipsum"
];
foreach(test; tests)
{
auto result = test.findSplitBefore!isWhite();
assert(result[0] == "prefix");
assert(result[1].stripLeft() == "postfix lorem ipsum");
}
}
----
It would be especially useful because `until` is strictly lazy and thus can't
be used with slicing to reproduce the above results.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------