View source code
							
							
						
								Display the source code in std/string.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								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.
							
						Function std.string.splitLines
Split s into an array of lines according to the unicode standard using
    '\r', '\n', "\r\n", lineSep,
    paraSep, U+0085 (NEL), '\v'  and '\f'
    as delimiters. If keepTerm is set to KeepTerminator, then the
    delimiter is included in the strings returned.
						
				C[][] splitLines(C)
				(
				
				  C[] s,
				
				  KeepTerminator keepTerm = No
				) pure @safe
				
				if (isSomeChar!C);
						
					
				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.
Parameters
| Name | Description | 
|---|---|
| s | a string of chars,wchars, ordchars, or any custom
        type that casts to astringtype | 
| 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
    splitter
Example
string s = "Hello\nmy\rname\nis";
writeln(splitLines(s)); // ["Hello", "my", "name", "is"]
Authors
Walter Bright, Andrei Alexandrescu, Jonathan M Davis, and David L. 'SpottedTiger' Davis
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.