Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

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".

Balazs Halasy (02/06/2004 3:00 pm)

Balazs Halasy (06/05/2005 7:17 am)


Comments

There are no comments.