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.stripLeft
Strips leading whitespace (as defined by std.uni.isWhite
).
Prototype
Range stripLeft(Range)( Range str ) if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range));
Parameters
Name | Description |
---|---|
str | string or ForwardRange of characters |
Returns
stripped of leading whitespace.
str
Postconditions
and the returned value
will share the same tail (see str
std.array.sameTail
).
Example
import std.uni : lineSep, paraSep; assert(stripLeft(" hello world ") == "hello world "); assert(stripLeft("\n\t\v\rhello world\n\t\v\r") == "hello world\n\t\v\r"); assert(stripLeft("hello world") == "hello world"); assert(stripLeft([lineSep] ~ "hello world" ~ lineSep) == "hello world" ~ [lineSep]); assert(stripLeft([paraSep] ~ "hello world" ~ paraSep) == "hello world" ~ [paraSep]); import std.utf : byChar; import std.array; assert(stripLeft(" hello world "w.byChar).array == "hello world ");
Authors
Walter Bright, Andrei Alexandrescu, and Jonathan M Davis