Product Site

5.1.7.62. delWord

Returns a copy of the receiving string after deleting the substring that starts at the nth word and is of length whitespace-delimited words. If you omit length, or if length is greater than the number of words from n to the end of the receiving string, the method deletes the remaining words in the receiving string (including the nth word). The length must be a positive whole number or zero. The n must be a positive whole number. If n is greater than the number of words in the receiving string, the method returns the receiving string unchanged. The string deleted includes any whitespace characters following the final word involved but none of the whitespace characters preceding the first word involved.
Example 5.100. String class — delWord method
Say "Now is the  time"~delWord(2,2)  -->  "Now time"
Say "Now is the time "~delWord(3)    -->  "Now is "
Say "Now is the  time"~delWord(5)    -->  "Now is the  time"
Say "Now is   the time"~delWord(3,1) -->  "Now is   time"