Checking a string parameter, Reading the length of a string parameter, Reading the alphabetic order – HEIDENHAIN TNC 320 (340 551-01) User Manual
Page 366: Reading system strings
366
10 Programming: Q Parameters
1
0
.1
2
S
tr
in
g
P
a
ra
m
e
te
rs
Checking a string parameter
With the INSTR function you can check whether a string parameter is
contained in another string parameter.
In SRC_QS, enter the string parameter to be searched. In SEA_QS,
enter the string parameter to be found. With the BEG function you can
specify a position to begin the search. As the result the TNC returns
the first position of appearance. If it does not find such a string
parameter, it returns the value 0.
Example: QS10 is checked, starting from the third character, for
whether it contains QS13
Reading the length of a string parameter
The STRLEN functions returns the length of a string parameter in the
given string variable.
Example: The length of QS15 is requested
Reading the alphabetic order
With the STRCOMP function you can find the alphabetic order of
string parameters. If the first string parameter (SRC_QS) is
alphabetically before the second (SEA_QS); the TNC returns the result
+1. With the reverse sequence the result is –1. If they are
alphabetically equal the result is 0.
Example: The alphabetic sequence of QS12 and QS14 is checked
Reading system strings
You can also read string parameters for many system variables (FN 18:
SYSREAD). Enter the ID for the system variables plus the value 10000.
Example: Read the path of the NC program chosen with SEL PGM
".."
37
Q50 = INSTR( SRC_QS10 SEA_QS13 BEG3 )
37
Q52 = STRLEN( SRC_QS15 )
37
Q52 = STRCOMP( SRC_QS12 SEA_QS14 )
37
QS14 = SYSSTR( ID10010 NR10 )