Construct a new FormatSpec using the format string fmt, no processing is done until needed.
Gives a string containing all of the member variables on their own line.
Write the format string to an output range until the next format specifier is found and parse that format specifier.
Special value for width and precision. DYNAMIC width or precision means that they were specified with '*' in the format string and are passed at runtime through the varargs.
Special value for precision, meaning the format specifier contained no explicit precision.
The format specifier contained a '-' (printf compatibility).
The format specifier contained a '#' (printf compatibility).
The format specifier contained a '+' (printf compatibility).
The format specifier contained a ','
The format specifier contained a ' ' (printf compatibility).
The format specifier contained a '0' (printf compatibility).
Index of the last argument for positional parameter range, from 1 to ubyte.max. (0 means not used).
Index of the argument for positional parameters, from 1 to ubyte.max. (0 means not used).
In case of a compound format specifier starting with "%$(LPAREN)" and ending with "%$(RPAREN)", _nested contains the string contained within the two separators.
Precision. Its semantics depends on the argument type. For floating point numbers, precision dictates the number of decimals printed.
In case of a compound format specifier, _sep contains the string positioning after "%|". sep is null means no separator else sep.empty means 0 length separator.
Character to insert between digits.
Set to DYNAMIC when the separator character is supplied at runtime.
Number of digits printed between separators.
The actual format specifier, 's' by default.
_trailing contains the rest of the format string.
Minimum width, default 0.
1 import std.array; 2 auto a = appender!(string)(); 3 auto fmt = "Number: %6.4e\nString: %s"; 4 auto f = FormatSpec!char(fmt); 5 6 assert(f.writeUpToNextSpec(a) == true); 7 8 assert(a.data == "Number: "); 9 assert(f.trailing == "\nString: %s"); 10 assert(f.spec == 'e'); 11 assert(f.width == 6); 12 assert(f.precision == 4); 13 14 assert(f.writeUpToNextSpec(a) == true); 15 16 assert(a.data == "Number: \nString: "); 17 assert(f.trailing == ""); 18 assert(f.spec == 's'); 19 20 assert(f.writeUpToNextSpec(a) == false); 21 assert(a.data == "Number: \nString: ");
A General handler for printf style format specifiers. Used for building more specific formatting functions.