Selection Of A Substring (Substr); Reading And Writing Of Individual Characters - Siemens SINUMERIK 840D sl Programming Manual

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

Advertisement

1.9.7

Selection of a substring (SUBSTR)

Function
Arbitrary parts within a string can be read with the SUBSTRING function.
Syntax
<STRING_ERG>=SUBSTR(<string>,<index>,<length>)
<STRING_ERG>=SUBSTR(<string>,<index>)
Meaning
SUBSTR
<index>
<length>
Example
Program code
DEF STRING[29] ERG
; 1
; 0123456789012345678
ERG = SUBSTR("QUITTUNG: 10 to 99", 10, 2)
ERG = SUBSTR("QUITTUNG: 10 to 99", 10)
1.9.8

Reading and writing of individual characters

Function
Individual characters can be read and written within a string.
The following supplementary conditions must be observed:
● Only possible with user-defined variables, not with system variables
● Individual characters of a string are only transferred "call by value" for subprogram calls
Job Planning
Programming Manual, 03/2013, 6FC5398-2BP40-3BA1
:
This function returns a substring from <string>, starting with <index> with the
specified <length>.
If the parameter <length> is not specified, the function returns a substring
starting with <index> until the end of the string.
:
Start position of the substring within the string. If the start position is after the
end of the string, an empty string (" ") is returned. First character of the
string: Index = 0
Range of values: 0 ... (string length - 1)
:
Length of the substring. If too long a length is specified, only the substring
up to the end of the string is returned.
Range of values: 1 ... (string length - 1)
Flexible NC programming
1.9 String operations
Comment
; ERG == "10"
; ERG == "10 to 99"
85

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik 828dSinumerik 840de sl

Table of Contents