vibe.utils.string

Utility functions for string processing

Types 1

aliascountUntilAny = indexOfAny

Functions 11

fnstring sanitizeUTF8(in ubyte[] str) @safe pure
deprecated Use `std.encoding.sanitize` instead
Takes a string with possibly invalid UTF8 sequences and outputs a valid UTF8 string as near to the original as possible.
fninout(char)[] stripUTF8Bom(inout(char)[] str) @safe pure nothrowStrips the byte order mark of an UTF8 encoded string. This is useful when the string is coming from a file.
fnbool allOf(const(char)[] str, const(char)[] chars) @safe pureChecks if all characters in 'str' are contained in 'chars'.
fnbool anyOf(const(char)[] str, const(char)[] chars) @safe pureChecks if any character in 'str' is contained in 'chars'.
fninout(char)[] stripLeftA(inout(char)[] s) @safe pure nothrowASCII whitespace trimming (space and tab)
fninout(char)[] stripRightA(inout(char)[] s) @safe pure nothrowASCII whitespace trimming (space and tab)
fninout(char)[] stripA(inout(char)[] s) @safe pure nothrowASCII whitespace trimming (space and tab)
fnsizediff_t indexOfAny(const(char)[] str, const(char)[] chars) @safe pureFinds the first occurence of any of the characters in `chars`
fnsizediff_t matchBracket(const(char)[] str, bool nested = true) @safe pure nothrowFinds the closing bracket (works with any of '[', '', '<', '{').
fnstring formatAlloc(Allocator, ARGS...)(scope Allocator alloc, string fmt, ARGS args)Same as std.string.format, just using an allocator.
fnint icmp2(const(char)[] a, const(char)[] b) @safe pure nothrowSpecial version of icmp() with optimization for ASCII characters