Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TRIM Function

12 views
Skip to first unread message

Mike Smith

unread,
Mar 23, 2015, 1:10:36 PM3/23/15
to
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


Thanks for any consideration.

Regards,

Mike



dpb

unread,
Mar 24, 2015, 5:15:11 PM3/24/15
to
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.

--

Mike Smith

unread,
Mar 26, 2015, 6:11:40 AM3/26/15
to
Do I need to include a library to access LENTRIM ?

Regards,

Mike Smith


"dpb" wrote in message news:mesk4t$is1$1...@www.openwatcom.org...

dpb

unread,
Mar 27, 2015, 9:54:14 AM3/27/15
to
On 03/26/2015 5:11 AM, Mike Smith wrote:
> Do I need to include a library to access LENTRIM ?
...

No, it's a supplied intrinsic (well, you don't need any _additional_
external libraries to be more precise)...

--

0 new messages