[an error occurred while processing this directive]
Forms Processor Advanced Commands
Contents   Index of Commands   Search the Forms Processor Docs   
sprintf Print data in the format you specify to a variable; usually to align text or round numbers.

$output = sprintf("format",variable_list);

Example:

# a not so uncommon large obnoxious number

$large_number = "20590.999999999998";

# round the number off to dollars and cents

$sub_total = sprintf("%6.2f",$large_number);

# now the sub_total contains "$20590.99"

$first_name = "Walt";
$last_name = "Webcom";

# concatenate first and last name is an index format

$name = sprintf("%s, %s",$last_name,$first_name);

# now name is "Webcom, Walt"
# print out the result

format screen

Customer index: $name
Your subtotal is: $sub_total
.


[an error occurred while processing this directive]