std.metastrings
Templates with which to do compile time manipulation of strings.Source:
std/metastrings.d
- template Format(A...)
- Formats constants into a string at compile time.
Analogous to std.string.format().
Parameters:
A = tuple of constants, which can be strings, characters, or integral values.
Formats:
The formats supported are %s for strings, and %% for the % character.
Example:
import std.metastrings; import std.stdio; void main() { string s = Format!("Arg %s = %s", "foo", 27); writefln(s); // "Arg foo = 27" }
- template ToString(ulong U)
template ToString(long I)
template ToString(uint U)
template ToString(int I)
template ToString(ushort U)
template ToString(short I)
template ToString(ubyte U)
template ToString(byte I)
template ToString(bool B)
template ToString(string S)
template ToString(char C) - Convert constant argument to a string.
- template ParseUinteger(string s)
- Parse unsigned integer literal from the start of string s.
Returns:
.value = the integer literal as a string, .rest = the string following the integer literal
Otherwise:
.value = null, .rest = s
- template ParseInteger(string s)
- Parse integer literal optionally preceded by '-'
from the start of string s.
Returns:
.value = the integer literal as a string, .rest = the string following the integer literal
Otherwise:
.value = null, .rest = s