strLeft (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


strLeft will return a specified number of characters from a string. It starts from the left and moves right.

 

Note that the returned string is a dynamic string.

 

Input:

str : STRING

String that is to be extracted from.

 

length : INT

Number of characters to be returned.

 

Returns: STRING

The extracted string.

 

Declaration:

FUNCTION strLeft : STRING;
VAR_INPUT
  str   : STRING;
  length : INT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR
  result : STRING;
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
result := strLeft(str:="hello world", length:=3);
  // result will contain "Hel" after the call
  ...
END;
 
END_PROGRAM;