Siebel eScript Language Reference > Siebel eScript Commands > The Global Object >

parseFloat() Method


This method converts an alphanumeric string to a floating-point decimal number.

Syntax

parseFloat(string)

Parameter
Description
string
The string to be converted

Returns

A floating-point decimal number; if string cannot be converted to a number, the special value NaN is returned.

Usage

Whitespace characters at the beginning of the string are ignored. The first non-white-space character must be either a digit or a minus sign (-). Numeric characters in string are read. The first period (.) in string is treated as a decimal point and any following digits as the fractional part of the number. Reading stops at the first non-numeric character after the decimal point. The result is converted into a number. Characters including and following the first non-numeric character are ignored.

Example

The following code fragment returns the result -234.37:

var num = parseFloat(" -234.37 profit");


 Siebel eScript Language Reference 
 Published: 18 April 2003