std.metastrings
Templates with which to do compile time manipulation of strings.
- 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); }
- 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(char[] S)
template ToString(char C)
- Convert constant argument to a string.
- template ParseUinteger(char[] 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(char[] 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