Unsupported content This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

sprintf/3—format a series of values into a  string


The sprintf/3 function formats a series of values into a string. The syntax of this function is as follows:

sprintf($STR,$FORMAT,$ARGS)
$STR=sprintf($FORMAT,$ARGS)

sprintf/3 arguments

Argument

Mode

Type

Description

$FORMAT

Input

STRING

Specifies the format for the resulting string

$ARGS

Input

LIST_OF ANY

Specifies the arguments to be printed as a string

$STR

Output

STRING

Resulting string

Use the sprintf/3 function to print a list of arguments specified in $ARGS into the $STR argument using the format specified in $FORMAT.

The format specification for sprintf/3 is the same as for the C language sprintf() function.

Warning

The arguments specified in $ARGS must be compliant with the specified format. Passing incompatible arguments can cause a crash of the cell.

sprintf/3 example

sprintf($E.msg,'Event #%x',[$E.event_handle]);

The msg slot is set to the event number in hexadecimal notation (%x format).

 

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*