Please enable JavaScript to view this site.

 

int = StrToInt(sString)

 

This macro function converts the string sString into a number.

 

The string representation of the number should have no formatting (ie. '1024' is OK, but '1.024' or '1,024' will generate an error). Passing any text that does not represent a number, to this function will generate an error.

StrToInt('1024') = 1024
StrToInt('0012') = 12
StrToInt('1.024') = Error !
StrToInt('1,024') = Error !
StrToInt('Elvis') = Error !

Leading zeros are acceptable (ie '0012').

 

Errors generated by this function will be handled according to the value you set for the RUNTIME_ERROR_HANDLING pre-compiler directive. Most of the time this means that the macro will be aborted.

 

See also: IntToStr.

 


Topic 108262, last updated on 18-Apr-2020