7.67.52015-05-06

Use Functions as Arguments

You can nest functions so that the value returned by one function becomes the argument for another function. For example, in the following example, the string returned by the @ function becomes one of two arguments for the strip function:

strip('*',@(36,25,58))

As a more complex example, consider the following:

if((pos('BLACK', strip( ' ', @(36,25,58))) > 0 ), 'old', 'new')

It returns the string ‘old’ if the data selection contains the string ‘BLACK’ and ‘new’ if it does not. When the PlanetPress Talk interpreter evaluates the statement, it first selects the data on line 36 of the current data page, from columns 25 through 58. It then sends that data to the strip command which removes all spaces in the data. It then sends the data (which now contains no spaces) to the pos command, which determines whether it contains the string ‘BLACK’. Finally, it compares the value returned by the pos command to 0, and returns the value of that comparison to the if command.