String FormatUnsigned(dword w)
Returns argument as decimal string.
String FormatInt(int i)
Returns integer as decimal string. If argument is Null, returns empty string.
String FormatUInt64(uint64 w)
Returns argument as decimal string.
String FormatInt64(int64 a)
Returns integer as decimal string. If argument is Null, returns empty string.
String FormatIntBase(int i, int radix, int width = 0, char lpad = ' ', int sign = 0, bool upper = false)
Formats a signed or unsigned integer i in a given radix with left padding to given width with a given lpad character. If sign is +1 = always prepend '+'/-, if 0 = auto ('-' only), if -1, format as unsigned. If upper is true, letters for base > 10 are uppercase. If i is Null, returns empty String.
String FormatIntDec(int i, int width, char lpad = ' ', bool always_sign = false)
Formats a signed decimal integer i with left padding up to given width characters (output longer than this is not padded) with a given lpad character. If always_sign is true, start positive numbers with '+' (negative numbers always start with '-').
String FormatIntHex(int i, int width = 8, char lpad = '0')
Formats an unsigned hexadecimal (radix 16) integer i with left padding up to given width characters (output longer than this is not padded) with a given lpad character.
String FormatIntOct(int i, int width = 12, char lpad = '0')
Formats an unsigned octal (radix 8) integer i with left padding up to given width characters (output longer than this is not padded) with a given lpad character.
String FormatIntRoman(int i, bool upper = false)
Formats a signed integer i in Roman numerals. The biggest "implemented" numeral is M (1000), so expect quite a long return string when formatting a billion. Negative numbers are prepended with [-], 0 or Null is output as a Null String. If upper is true, use uppercase [true] or lowercase [false] letters
String FormatIntAlpha(int i, bool upper = true)
Formats a signed integer i in length-first lexicographic index, i.e. excel column numbering (1 = A,2 = B.. 26 = Z, 27 = AA, 28 = AB .. 52 = AZ, 53 = BA ... 78 = BZ etc). 0 or Null is output as a Null String. Only negative numbers are prepended with a [-]. If upper is true, use uppercase letter.
String Format64Hex(uint64 a)
Formats an unsigned hexadecimal a (radix 16) 64-bit integer. Supposed to be quite fast. Lowecase letters a-f are used for digits [10] through [15].
String FormatIntHex(const void *ptr)
Formats the pointer address ptr as a hexadecimal (base 16) number zero-padded to the number of digits appropriate for the memory model (8 digits in 32-bit systems, 16 digits in 64-bit systems). Useful for logging and debugging purposes. Equivalent to FormatHex, god knows why there are two of them.
String FormatHex(const void *ptr)
Same as FormatIntHex.
char *FormatDouble(char *t, double x, int precision, dword flags = FD_TOLERANCE(6)|FD_MINIMAL_EXP|FD_SPECIAL)
String FormatDouble(double x, int precision, dword flags = FD_TOLERANCE(6)|FD_MINIMAL_EXP|FD_SPECIAL)
Formats a floating point number d in decimal notation automatically selecting ordinary or scientific (exponential) notation according to the FD_TOLERANCE flag.
The first variant requires the buffer of size precision + 30 and returns a pointer after the last character produced (terminating '\0' is NOT appended).
precision represents the number of valid digits.
flags can be a binary combination
|
FD_SIGN
|
always prepend sign (+10)
|
FD_MINUS0
|
print minus sign for negative zero (-0.0)
|
FD_SIGN_EXP
|
always prepend sign to exponent (1e+2)
|
FD_CAP_E
|
capital E for exponent (1E10)
|
FD_ZEROS
|
keep trailing zeros (1.25000)
|
FD_MINIMAL_EXP
|
use minimal exponent (1e5 instead 1e+05)
|
FD_TOLERANCE(x)
|
number of zeroes allowed between the decimal points and valid digits to the right before switching to E notation
|
FD_SPECIAL
|
allow nan / inf printing (otherwise such numbers are printed as empty)
|
FD_FIX
|
always use fixed notation (redirects FormatDouble to FormatF)
|
FD_EXP
|
always use exponential notation (redirects FormatDouble to FormatE)
|
FD_SIGN_SPACE
|
prepend space in place of sign for positive numbers
|
FD_POINT
|
always add decimal point
|
|
char *FormatDouble(char *t, double x)
String FormatDouble(double a)
Same as FormatDouble with flags FD_TOLERANCE(6)|FD_MINIMAL_EXP|FD_SPECIAL and precision 15. Should represent the most reasonable formatting for displayed output. The first variant requires the buffer of size 32 and returns a pointer after the last character produced (terminating '\0' is NOT appended).
char *FormatE(char *t, double x, int precision, dword flags)
String FormatE(double x, int precision, dword flags)
With default flags provides double formatting equivalent to %e printf format. The first variant requires the buffer of size precision + 30 and returns a pointer after the last character produced (terminating '\0' is NOT appended).
char *FormatF(char *t, double x, int precision, dword flags)
String FormatF(double x, int precision, dword flags)
With default flags provides double formatting equivalent to %f printf format. The first variant requires the buffer of size precision + 400 and returns a pointer after the last character produced (terminating '\0' is NOT appended).
char *FormatG(char *t, double x, int precision, dword flags)
String FormatG(double x, int precision, dword flags)
With default flags provides double formatting equivalent to %g printf format. The first variant requires the buffer of size precision + 30 and returns a pointer after the last character produced (terminating '\0' is NOT appended).
String FormatBool(bool a)
Formats a boolean a as one of the fixed words "true" or "false" (regardless of language settings).
String FormatIntBase(int i, int base, int width = 0, char lpad = ' ', int sign = 0)
Formats integer i with given numeric base, result width charters wide with lpad padding.
|