Product Site

5.1.7.92. substr

Returns the substring of the receiving string that begins at the nth character and is of length length, padded with pad if necessary. The n must be a positive whole number. If n is greater than receiving_string~length, only pad characters are returned.

If you omit length, the rest of the string is returned. The default pad character is a blank.

See also methods [], subChar, left, and right.

In some situations the positional (numeric) patterns of Parsing templates are more convenient for selecting substrings, in particular if you need to extract more than one substring from a string.
Example 5.126. String class — substr method
"abc"~substr(2)          -->    "bc"
"abc"~substr(2,4)        -->    "bc  "
"abc"~substr(2,6,".")    -->    "bc...."