Programming Qparameters | String parameters
9
Testing a string parameter
The INSTR function checks whether (and where) a string parameter
is contained in another string parameter.
Select Q parameter function
Press the FORMULA soft key
Enter the number of the Q parameter for the result
and confirm with the ENT key
The control saves the place at which the text to be
searched for begins. It is saved in the parameter.
Shift the soft-key row
Select the function for checking a string
parameter
Enter the number of the QS parameter in which
the text to be searched for is saved. Confirm with
the ENT key
Enter the number of the QS parameter to be
searched for by the control, and confirm with the
ENT key
Enter the number of the place at which the control
is to start search the substring, and confirm with
the ENT key.
Close the parenthetical expression with the ENT
key and confirm your entry with the END key
The first character of a text string starts internally at the
0-position
If the control cannot find the required substring, it
will save the total length of the string to be searched
(counting starts at 1) in the result parameter.
If the substring to be searched for appears multiple
times, then the control returns the first place at which it
finds the substring.
Example: Search through QS10 for the text saved in parameter
QS13. Begin the search at the third place.
37 Q50 = INSTR ( SRC_QS10 SEA_QS13 BEG2 )
318
HEIDENHAIN | TNC620 | Klartext Programming User's Manual | 01/2022