FORMAT
Command: #format {variable} {format} {argument1} {argument2} {etc}
Allows you to store a string into a variable in the exact same way
C's sprintf works with a few enhancements and limitations like a
maximum of 30 arguments.
If you use #format inside an alias or action you must escape %1s as
%+1s or %%1s or %\1s so the %1 isn't substituted by the trigger.
#format {test} {%+9s} {string} pad string with up to 9 spaces
#format {test} {%-9s} {string} post pad string with up to 9 spaces
#format {test} {%.8s} {string} copy at most 8 characters
#format {test} {%a} {number} print corresponding charset character
#format {test} {%c} {string} use a highlight color name
#format {test} {%d} {number} print a number with integer formatting
#format {test} {%f} {string} perform floating point math
#format {test} {%g} {number} perform thousand grouping on {number}
#format {test} {%h} {string} turn text into a header line
#format {test} {%l} {string} lowercase text
#format {test} {%m} {string} perform mathematical calculation
#format {test} {%n} {name} capitalize the first letter
#format {test} {%p} {string} strip leading and trailing spaces
#format {test} {%r} {string} reverse text, hiya = ayih
#format {test} {%s} {string} print given string
#format {test} {%t} {format} display time with strftime format
optional {{format}{time}} syntax
#format {test} {%u} {string} uppercase text
#format {list} {%w} {string} store word wrapped text in {list}
optional {{string}{width}} syntax
#format {test} {%x} {hex} print corresponding charset character
#format {test} {%A} {char} store corresponding character value
#format {test} {%D} {hex} convert hex to decimal in {test}
#format {hash} {%H} {string} store a 64 bit string hash in {hash}
#format {test} {%L} {string} store the string length in {test}
#format {test} {%M} {number} convert number to metric in {test}
#format {test} {%S} {string} store the number of spelling errors
#format {time} {%T} {} store the epoch time in {time}
#format {time} {%U} {} store the micro epoch time in {time}
#format {test} {%X} {dec} convert dec to hexadecimal in {test}
#format {test} {%%} a literal % character
Comment: See #help TIME for help on the %t argument.
Related: cat, echo, function, local, math, replace, script, time and variable.
|