1
Flexible NC Programming 04.00
1.10 Strin
o
erations
1
840D
NCU 571
840D
NCU 572
NCU 573
FM-NC 810D 840Di
ï›™
Siemens AG 2000. All rights reserved
1-52
SINUMERIK 840D/840Di/810D/FM-NC Programming Guide Advanced (PGA)
−
04.00 Edition
INDEX searches from beginning of first parameter for character specified as second
parameter.
RINDEX searches from end of first parameter for character specified as second parameter.
MINDEX corresponds to INDEX function except that a list of characters is transferred (as
string). The index of the first character found in this list is returned.
MATCH looks for a string within a string.
Strings can therefore be broken down according to
certain criteria, i.e. at positions with blanks or path
separator (oblique) ("/").
Programming example
Example of how to break down an input into path
and module name:
DEF INT PATHIDX, PROGIDX
DEF STRING[26] INPUT
DEF INT LISTIDX
INPUT = "/_N_MPF_DIR/_N_EXECUTE_MPF"
LISTIDX = MINDEX (INPUT, "M,N,O,P")
+ 1
3 is returned as the value in LISTIDX;
because "N" is the first character in
parameter INPUT (starting at beginning
of selection list).
PATHIDX = INDEX (INPUT, "/") +1
; PATHIDX is therefore 1
PROGIDX = RINDEX (INPUT, "/") +1
; PROGIDX = is therefore 12
;Using the SUBSTR function introduced
in the next section, the variable INPUT
can be broken down into "Path" and
"Module":
VARIABLE = SUBSTR (INPUT, PATHIDX,
PROGIDX-PATHIDX-1)
Then supplies "_N_MPF_DIR"
VARIABLE = SUBSTR (INPUT, PROGIDX)
Then supplies "_N_EXECUTE_MPF"