dmd.root.string

Contains various string related functions.

Members

Functions

dstrcmp
int dstrcmp(char[] s1, char[] s2)

A string comparison functions that returns the same result as strcmp

startsWith
bool startsWith(const(char)* p, const(char)[] needle)

Checks if C string p starts with needle.

stripLeadingLineTerminator
string stripLeadingLineTerminator(string str)

Strips one leading line terminator of the given string.

toCStringThen
auto toCStringThen(const(char)[] src)

Copy the content of src into a C-string ('\0' terminated) then call dg

toDString
inout(char)[] toDString(inout(char)* s)

Slices a \0-terminated C-string, excluding the terminator

toStaticArray
char[N + 1] toStaticArray(const(char)[N] 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. * * Params: * literal = string literal * * Notes: * - LDC produces quite optimal code for short strings: * - https://d.godbolt.org/z/M69Z1g * - https://gist.github.com/PetarKirov/338e4ab9292b6b2b311a3070572a07fb (backup URL)

Static functions

iequals
bool iequals(const(char)[] s1, const(char)[] s2)

Compare two slices for equality, in a case-insensitive way

Meta

Suggestion Box / Bug Report