4.12. Formatting and conversion functions #

4.12.1. format()
4.12.2. printf()
4.12.3. str()
4.12.4. val()

4.12.1. format() #

It takes two operands, the first operand is of any type, the second operand is a string. This function formats the first value according to the second operand as a format string. If the first operand doesn't match the expected type in the format string, an error is returned.

It an RLIB compatibility function and is a special case of the printf() function. See Formatting data.

4.12.2. printf() #

This function takes one or more operands. The first operand is a string and used as the format string. Subsequent operands have to be of the expected type according to the format string, otherwise an error is returned. If everything is correct, it returns the formatted data as a string. See Formatting data.

4.12.3. str() #

It takes three numeric operands. The first operand is converted to a string with the length and number of decimal digits specified by the second and the third operands, respectively.

4.12.4. val() #

Numeric value. It takes one numeric or string operand.

If a string value is passed, and it can be converted to a numeric value successfully, then it returns the converted numeric value.

The value of a numeric operand is passed through as is.