On 03/23/2015 12:10 PM, Mike Smith wrote:
> Hi Group,
>
> I understand that Watcom F77 does not have a TRIM function.
>
> Does anyone have to share a developed TRIM function for the following:
>
> 1) Remove all spaces from a ASCII string
> 2) Remove leading spaces
> 3) Remove trailing spaces
...
There's the Watcom extension LENTRIM(str) so you can easily get the
position of the last non-blank character. Then there's really nothing
but to traverse the string variable from 1 forward until find the first
character that isn't a blank. You then return the string within those
to indices.
NB: You cannot write a function that returns a variable-length
character string so don't be thinking that's going to be the end result.
--