FORMAT
From STX Wiki
Jump to navigationJump to search
var := FORMAT formatstring arg1 [ arg2 ... ]
format
formats its arguments, interpreting the first argument as a format string (almost, but not quite unlike the C-language printf
command). STx formats are described in Format Strings and Rules.
#srateHz := 44100 #SRSTR := FORMAT '%.1f kHz' '$#srateHz/1000' // Here, the variable#SRSTR
is assigned the string '44.1 kHz
'.
Note that, unlike with the C-language printf
formats, the first argument arg1
is mandatory with the STx format
command:
#str := format 'How much wood would a wood chuck chuck?' 'dummy'
Here, the dummy argument (in our case, the string constant 'dummy'
) is mandatory, although it will not influence the result of the string "How much wood would a wood chuck chuck?" being assigned to the variable #str.