Search For Character/String In The String (Index, Rindex, Mindex, Match) - Siemens Sinumerik 840D sl Programming Manual

Job planning
Hide thumbs Also See for Sinumerik 840D sl:
Table of Contents

Advertisement

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:
RINDEX:
MINDEX:
MATCH:
This allows strings to be broken up according to certain criteria, for example, at positions with
blanks or path separators ("/").
Example
Breaking up an input into path and block names
Program code
DEF INT PFADIDX, PROGIDX
DEF STRING[26] INPUT
DEF INT LISTIDX
INPUT = "/_N_MPF_DIR/_N_EXECUTE_MPF"
LISTIDX = MINDEX (INPUT, "M,N,O,P") + 1
Job planning
Programming Manual, 02/2011, 6FC5398-2BP40-1BA0
Searches for the character specified as second parameter (from the
beginning) in the first parameter.
Searches for the character specified as second parameter (from the end) in
the first parameter.
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.
Searches for a string in a string.
Flexible NC programming
1.9 String operations
Comments
; The value returned in LISTIDX is 3;
because "N" is the fist character in
the parameter INPUT from the
selection list starting from the
beginning.
81

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik 840de slSinumerik 828d

Table of Contents