Kilowatt Software L.L.C.
Classic Rexx Tutorial
Language Level 4.00 (TRL-2)
Subword built-in function
The Subword function returns a sequence of words in another string.
The result never has leading or trailing spaces.
Spaces between the sequence of extracted words are retained.
result = Subword( string, n [, [ length ] )
- the original string
- the position where the substring of words begins. A value of 1 indicates the first word in the string.
When the position exceeds the length of the original string, then the empty string is returned
- the number of words to extract. Only the remaining words are returned, when the length exceeds the
number of remaining words after the Nth position. When this argument is absent, the remainder of the
string is returned.
say Subword( 'abra cad abra', 2, 1 ) -- shows: cad
say Subword( 'abra cad abra', 2 ) -- shows: cad abra
say Subword( 'abra cad abra', 5 )'_' -- shows: _
Kilowatt Software L.L.C. -- Classic Rexx Tutorial -- Back to top
Click here if you have any comments or questions regarding this tutorial
Last updated on: 11 Apr 2006