data.string ≡
const auto eol = " " §source
End-of-line string
const auto empty = "" §source
Empty string
inline string show(auto x) §source
String representation of the argument
Example
>>> show(bitsizeof uint32);
"32"
inline string append(string x, string y) §source
Append two strings
Example
>>> append("foo", "bar")
"foobar"
template <auto N> inline string replicate(string x) §source
Return a string that contains x replicated
N times
template <auto N> inline string concatenate(string[N] x) §source
Concatenate an array of strings
Example
>>> concatenate({"f", "o", "o", eol});
"foo\n"
template <typename T, auto N> inline string fold_map((T) -> string fn, T[N] x) §source
Map elements of an array to strings and concatenate results
Example
>>> fold_map(show, {0, 1, 2, 3, 4});
"01234"
template <auto N> inline string unlines(string[N] x) §source
Append end-of-line to each input string and concatenate
Example
>>> unlines({0, 1, 2, 3, 4});
"0\n1\n2\n3\n4\n"
template <typename T, auto N> inline string punctuate(string sep, T[N] x) §source
Join string representations of input values with a separator
Example
>>> punctuate(", ", {0, 1, 2, 3, 4});
"0, 1, 2, 3, 4"
template <typename T, auto N> inline string unwords(T[N] x) §source
Join string representations of input values with separating spaces
Example
>>> unwords({0, 1, 2, 3, 4});
"0 1 2 3 4"
template <typename T, auto N> inline string comma_sep(T[N] x) §source
Comma separate values
Example
>>> comma_sep({0, 1, 2, 3, 4});
"0, 1, 2, 3, 4"
inline string parens(auto x) §source
Wrap a value in parentheses
inline string braces(auto x) §source
Wrap a value in braces
inline string brackets(auto x) §source
Wrap a value in square brackets
inline string angles(auto x) §source
Wrap a value in angle brackets
inline string quotes(auto x) §source
Wrap a value in quotes
inline string squotes(auto x) §source
Wrap a value in single quotes
inline string backquotes(auto x) §source
Wrap a value in backquotes