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

StrToInt

Converts a string into an integer. 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 " + " or a " - " sign, the return value is 0 (zero).

Syntax

StrToInt(String)

String:

The string to convert.

Return Value

An integer (converted from String).

Related Functions

StrToReal, StrToValue

Example

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

See Also

String Functions