Flexible NC programming
1.9 String operations
Job planning
Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
81
1.9.6 Search for character/string in the string (INDEX, RINDEX, MINDEX, MATCH)
Function
This functionality searches for single characters or a string within a string. The function
results specify where the character/string is positioned in the string that has been searched.
Syntax
INT_ERG=INDEX(STRING,CHAR) ; Result type: INT
INT_ERG=RINDEX(STRING,CHAR) ; Result type: INT
INT_ERG=MINDEX(STRING,STRING) ; Result type: INT
INT_ERG=MATCH(STRING,STRING) ; Result type: INT
Semantics
Search functions: It supplies the position in the string (fist parameter) where the search has
been successful. If the character/string cannot be found, then the value -1 is returned. The
first character has position 0.
Significance
INDEX: Searches for the character specified as second parameter (from the
beginning) in the first parameter.
RINDEX: Searches for the character specified as second parameter (from the end) in
the first parameter.
MINDEX: Corresponds to the INDEX function, except for the case that a list of
characters is transferred (as string) in which the index of the first found
character is returned.
MATCH: Searches for a string in a string.
This allows strings to be broken up according to certain criteria, for example, at positions
with blanks or path separators ("/").