View source code
Display the source code in dmd/root/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.

Module dmd.root.string

Contains various string related functions.




dstrcmp(s1, s2) A string comparison functions that returns the same result as strcmp
findBetween(str, l, r) Find a string inbetween two substrings
findSplit() Find a substring in a string and split the string into before and after parts.
iequals(s1, s2) Compare two slices for equality, in a case-insensitive way
splitLines(text) Take text and turn it into an InputRange that emits slices into text for each line.
startsWith(p, needle) Checks if C string p starts with needle.
stripLeadingLineTerminator(str) Strips one leading line terminator of the given string.
toCString(s) Convert a D string to a C string by allocating memory, copying it, and adding a terminating 0.
toCStringThen(src) Copy the content of src into a C-string ('\0' terminated) then call dg
toDString(s) Slices a \0-terminated C-string, excluding the terminator
toStaticArray(literal) Infers the length N of a string literal and coerces its type to a static array with length N + 1. Returns the string with a null character appended to the end.


Walter Bright,


Boost License 1.0