float
Summary
Converts the input parameter to a float.
Usage
input|float()
Returns
A float representation of the input parameter.
Description
This operator attempts to convert the input parameter to a float. It returns the converted value as a float. If the operator is unable to do the conversion, it will return a value of zero (0).
Examples
Example 1
{def $pi='3.1415'}
Value: {$pi|float()}Converts the string "3.1415" and returns it as a float. The following output will be produced: "Value: 3.1415".
Example 2
{def $pi='three point fourteen'}
Value: {$pi|float()}The following output will be produced: "Value: 0".
Contributors
- Balazs Halasy Updated
Comments
Add a comment