Product SiteDocumentation Site

7.4.63. SUBWORD


>>-SUBWORD(string,n--+---------+--)----------------------------><
                     +-,length-+

Returns the substring of string that starts at the nth word, and is up to length whitespace-delimited words. n must be a positive whole number. If you omit length, it defaults to the number of remaining words in string. The returned string never has leading or trailing whitespace, but includes all whitespace characters between the selected words.
Here are some examples:

Example 7.85. Builtin function SUBWORD

SUBWORD("Now is the  time",2,2)    ->    "is the"
SUBWORD("Now is the  time",3)      ->    "the  time"
SUBWORD("Now is the  time",5)      ->    ""