View source code
Display the source code in std/regex.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
std.regex.splitter
- multiple declarations
- Function splitter
- Struct Splitter
Function splitter
A helper function, creates a
on range Splitter
separated by r
regex
.
Captured subexpressions have no effect on the resulting range.
pat
Prototype
Splitter!(Range,RegEx) splitter(Range, RegEx)( Range r, RegEx pat ) if (is(BasicElementOf!Range : dchar) && isRegexFor!(RegEx, Range));
Struct Splitter
Range that splits a string using a regular expression as a separator.
Properties
Name | Type | Description |
---|---|---|
empty
[get]
|
bool |
Forward range primitives. |
front
[get]
|
Range |
Forward range primitives. |
save
[get]
|
|
Forward range primitives. |
Methods
Name | Description |
---|---|
popFront
|
Forward range primitives. |
Example
auto s1 = ", abc, de, fg, hi, "; assert(equal(splitter(s1, regex(", *")), ["", "abc", "de", "fg", "hi", ""]));
Authors
Dmitry Olshansky,
API and utility constructs are modeled after the original
by Walter Bright and Andrei Alexandrescu.
std.regex