Module contains type to string formatters for some types.
Procs
proc intToStr*(n: SomeNumber; radix = 10; len = 0; fill = ' '): string
- Converts n to string. If n is SomeReal, it casts to int64. Conversion is done using radix. If result's length is lesser then len, it aligns result to the right with fill char. If len is negative, the result is aligned to the left. Source Edit
proc alignStr*(s: string; len: int; fill = ' '; trunc = false): string
- Aligns s using fill char to the right if len is positive, or to the left, if len is negative. If the length of s is bigger then abs(len) and trunc == true, truncates s Source Edit
proc floatToStr*(v: SomeNumber; len = 0; prec = 0; sep = '.'; fill = ' '; scientific = false): string
- Converts v to string with precision == prec. If result's length is lesser then len, it aligns result to the right with fill char. If len is negative, the result is aligned to the left. Source Edit