Product Site

5.1.7.93. subWord

Returns the substring of the receiving string that starts at the nth word and is up to length whitespace-delimited words. The n must be a positive whole number. If you omit length, it defaults to the number of remaining words in the receiving string. The returned string never has leading or trailing whitespace, but includes all whitespace characters between the selected words.
Example 5.127. String class — subWord method
"Now is the  time"~subWord(2,2)    -->    "is the"
"Now is the  time"~subWord(3)      -->    "the  time"
"Now is the  time"~subWord(5)      -->    ""