previous next top contents index framed top this page unframed
Figure 46–22. $removeLastWord
| STRING PROCEDURE $removeLastWord (MODIFIES STRING s); |
$removeLastWord first removes trailing whitespace characters from s, where whitespace characters are blank, tab, end-of-page, carriage return, and linefeed. It then removes all characters from the end of the STRING back to the previous whitespace character (or beginning of STRING); these characters constitute the “word”. It then removes any additional trailing whitespace characters from s, and returns the word.
Example 46–23. Use of $removeLastWord
| STRING s,ss; s := "Hello, there!"; ss := $removeLastWord(s); # Now ss = "there!" and s = "Hello,". |
MAINSAIL Language Manual, Section 46.18