string Format(string destString, string fmtString[, parameters])
Formats the fmtString with the given parameters and stores it in destString. It then returns a pointer to the destString.
There are a number of formatting options which can be used. They are the following:
Digit Formatting | |
%d | Reads a number (digit) parameter, and prints it in the string in ASCII. Example
Format(aString "Number: %d" 5) //
Would print "Number: 5" |
%0nd | Reads a number (digit) parameter, and prints it in the string in ASCII with n number of leading 0s. Example
Format(aString "Number: %03d" 5) // Would print "Number: 005" |
%nd | Reads a number (digit) parameter, and prints it in the string in ASCII with n number of leading spaces. Example
Format(aString "Number: %3d" 5) // Would print "Number: 5" |
%-nd | Reads a number (digit) parameter, and prints it in the string in ASCII with n number of trailing spaces. Example
Format(aString "Number: %-3d" 5) // Would print "Number: 5 " |
Unsigned digit Formatting | |
%u8% | Reads a number (digit) parameter, and prints it in the string in ASCII. This works the same as %d, but
does not prints all positive numbers.. Example
Format(aString "Number: %u" 5) //
Would print "Number: 5" |
%0nu | Reads a number (digit) parameter, and prints it in the string in ASCII with n number of leading 0s. Example
Format(aString "Number: %03u" 5) // Would print "Number: 005" |
%nu | Reads a number (digit) parameter, and prints it in the string in ASCII with n number of leading spaces. Example
Format(aString "Number: %3u" 5) // Would print "Number: 5" |
%-nu | Reads a number (digit) parameter, and prints it in the string in ASCII with n number of trailing spaces. Example
Format(aString "Number: %-3u" 5) // Would print "Number: 5 " |
Hex Formatting | |
%x | Reads a number (digit) parameter, and prints it in the string in hex. Example
Format(aString "Number: %x" $A5) // Would print "Number: A5" |
%0nx | Reads a number (digit) parameter, and prints it in the string in ASCII with n number of leading 0s. Example
Format(aString "Number: %03x" $A5) // Would print "Number: 0A5" |
%nx | Reads a number (digit) parameter, and prints it in the string in ASCII with n number of leading spaces. Example
Format(aString "Number: %3x" $A5) // Would print "Number: A5" |
%-nx | Reads a number (digit) parameter, and prints it in the string in ASCII with n number of trailing spaces. Example
Format(aString "Number: %-3x" $A5) // Would print "Number: A5 " |
String Formatting | |
%s | Reads a string parameter, and prints it in the string. Example
Format(aString "String: %x" "Hello") //
Would print "String: hello" |
%ns | Reads a string parameter, and prints it in the string with n number of leading spaces. Example
Format(aString "String: %10s" "Hello") //
Would print "String: Hello" |
%-ns | Reads a string parameter, and prints it in the string with n number of trailing spaces. Example
Format(aString "String: %-10s" "Hello") //
Would print "String: Hello " |
see also: StrCpy