strToInt (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


strToInt will convert a string to a number (INT). If the conversion is not possible, strToInt will return 0.

 

Input:

str : STRING

String to convert.

 

Returns: INT

The value of the string.

 

Declaration:

FUNCTION strToInt : INT;
VAR_INPUT
  str : STRING;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR
  result : INT;
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
result := strToInt(str:="4711");
  // result will contain 4711 after the call
  ...
END;
 
END_PROGRAM;