1.9.7
Selection of a substring (SUBSTR)
Function
This functionality extracts a substring from a string. For this purpose, the index of the first
character and the desired string length (if applicable) are specified. If no length information is
specified, then the string data refers to the remaining string.
Syntax
STRING_ERG = SUBSTR (STRING,INT) ; Result type: INT
STRING_ERG = SUBSTR(STRING,INT, INT) ; Result type: INT
Semantics
In the first case, the substring from the position specified by the second parameter is
returned up to the end of the string.
In the second case, the result string is limited to the maximum length, specified by the third
parameter.
If the initial position is after the end of the string, the empty string (" ") will be returned.
If the initial position or the length is negative, an alarm is output.
Example
Program code
DEF STRING[29] ERG
ERG = SUBSTR ("ACK:10 to 99", 10, 2)
Job Planning
Programming Manual, 06/2009, 6FC5398-2BP20-0BA0
Flexible NC programming
1.9 String operations
Comments
; Therefore the following
applies: ERG == "10"
89