%SUBST Used for its Value

%SUBST returns a substring from the contents of the specified string. The string may be any character, graphic, or UCS-2 field or expression. Unindexed arrays are allowed for string, start, and length. The substring begins at the specified starting position in the string and continues for the length specified. If length is not specified then the substring continues to the end of the string. For example:


The value of  %subst('Hello World': 5+2) is  'World'
The value of  %subst('Hello World':5+2:10-7) is 'Wor'
The value of  %subst('abcd' + 'efgh':4:3) is 'def'

For graphic or UCS-2 characters the start position and length is consistent with the 2-byte character length (position 3 is the third 2-byte character and length 3 represents 3 2-byte characters to be operated on).

Figure 258 shows an example of the %SUBST built-in function used for its value.



[ Top of Page | Previous Page | Next Page | Contents | Index ]