Cicode Programming Reference > Cicode Function Categories > String Functions Introduction > StrToReal

StrToReal

Converts a string into a floating-point number. This function will search the string for the first non-blank character, and then start converting until it finds the end of the string or a non-numeric character. If the first non-blank character is not a numeric character (0-9), a space, a decimal point, a " + " or a " - " sign, the return value is 0 (zero).

Syntax

StrToReal(String)

String:

The string to convert.

Return Value

A floating-point number (converted from String).

Related Functions

StrToInt, StrToValue

Example

Variable=StrToReal("45");
! Sets Variable to 45.
Variable=StrToReal("45.23");
! Sets Variable to 45.23
Variable=StrToReal("A45");
! Sets Variable to 0.

See Also

String Functions