Format


 

Format>format_string,data,result

 

Formats the given data into the string provided.

 

Each data formatting substring starts with a % and ends with a data type indicator :

 

d     = Decimal (integer)

e     = Scientific

f     = Fixed

g     = General

m     = Money

n     = Number (floating)

p     = Pointer

s     = String

u     = Unsigned decimal

x     = Hexadecimal

 

The general format of each formatting substring is as follows:

 

%[-][Width][.Precision]Type

 

Where items in square brackets are optional.

 

See examples below.

 

Example

 

//just insert a string in a string

Let>data=45.12

Format>string is: %s,data,result

//Result becomes: "string is: 45.12"

 

//set floating point number to 6 decimal places

Format>%.6n,data,result

//Result becomes: 45.120000

 

Let>data=1234

Format>%.8d,data,result

//Result becomes: 00001234

 

//left padded:

Format>Padded: <%7d>,data,result

//Result becomes: "Padded: <   1234>"

 

//Right padded:

Format>Padded: <%-7d>,data,result

//Result becomes: "Padded: <1234   >"

 

//Money

Let>data=134.647

Format>Price: %m,data,result

//Result becomes: "Price: $134.65" (currency symbol from system)

 

//To hex

Format>%x,324234,result

//Result becomes: 4F28A