View source code
Display the source code in std/string.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.
Function std.string.splitLines
Split into an array of lines according to the unicode standard using
s'\r', '\n', "\r\n", std.uni.lineSep,
std.uni.paraSep, U+0085 (NEL), '\v' and '\f'
as delimiters. If is set to keepTermKeepTerminator.yes, then the
delimiter is included in the strings returned.
Does not throw on invalid UTF; such is simply passed unchanged to the output.
Allocates memory; use lineSplitter for an alternative that
does not.
Adheres to Unicode 7.0.
Prototype
S[] splitLines(S)( S s, KeepTerminator keepTerm = KeepTerminator.no ) pure @safe if (isSomeString!S);
Parameters
| Name | Description |
|---|---|
| s | a string of chars, wchars, or dchars |
| keepTerm | whether delimiter is included or not in the results |
Returns
array of strings, each element is a line that is a slice of s
See Also
lineSplitter
std.algorithm.splitter
std.regex.splitter
Authors
Walter Bright, Andrei Alexandrescu, and Jonathan M Davis