phrase='Now is the time for a party' say phrase.word(7).pos('r')The second line here can be read from left to right as:
take the variable phrase, find the seventh word, and then find the position of the first r in that word.This would display 3 in this case, because r is the third character in party.
(In Rexx, the second line above would have been written using nested function calls:
say pos('r', word(phrase, 7))which is not as easy to read; you have to follow the nesting and then backtrack from right to left to work out exactly what's going on.)
In the NetRexx syntax, at each point in the sequence of operations some routine is acting on the result of what has gone before. These routines are called methods, to make the distinction from functions (which act in isolation). NetRexx provides (as methods) most of the functions that were evolved for Rexx, including:
These and the others like them, and the parsing described in the next section, make it especially easy to process text with NetRexx.
[previous | contents | next]