format( fmt, args ... )

Returns a new string, built from the control string fmt, formatted with the specified arguments. e.g. the following example:

:-) "There are %p results".format( 56 );
There is 1 result
"There are 56 results"
      

The control string can contain tokens, which will be replaced on application of the format function. Tokens begin with %, followed by an optional number, then a character to indicate the type of formatting. The following tokens are currently valid:

%p
The equivalent of print, the next argument is printed at this position in the control string. e.g.
:-) "Hel%p%p %p %phere".format( 'lo', "you", `T` );
There is 1 result
"Hello you There"
          
%s
The equivalent of show, the next argument is printed in a programmer oriented way at this position in the control string. e.g.
:-) "Hel%s%s %s %shere".format( 'lo', "you", `T` );
There is 1 result
"Hel'l''o' "you" `T`here"
          
%x
Prints the hexadecimal representation of the next argument at this position in the control string. Note: the next argument must be an integer. e.g.
:-) "color: #%x".format( 255 );
There is 1 result
"color: #ff"
          
%%
Inserts a single % at this position in the control string. e.g.
:-) "width: %p%%".format( 100 );
There is 1 result
"width: 100%"