![]() |
|
||||||||||||
|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
Hi,
If written a function wich Itrim's a string: ( s s ) ITRIM gives (s s) Here's the code: /ITRIM { /st1 exch def /st2 st1 length string def /p1 0 def /teken 0 def /tekv 32 def % see if a character is <space> st1 { /teken exch def teken 32 ne tekv 32 ne or { st2 p1 teken put /p1 p1 1 add def } if /tekv teken def } forall % see if last character is <space> p1 0 gt { st2 p1 1 sub get 32 eq { /p1 p1 1 sub def } if } if st2 0 p1 getinterval } def It seems to work perfectly. Greetings RobertB |
|||
|
Nice code but that's already a VIPP function called BSTRIP so no need to re-invent the wheel :-)
|
||||
|
No,
BSTRIP only remove spaces from the end and the beginning: (<SPACE>a<SPACE><SPACE>a<SPACE> ) BSTRIP gives (a<SPACE><SPACE>a) (<SPACE>a<SPACE><SPACE>a<SPACE> ) ITRIM gives (a<SPACE>a) So it's very handy I think. [This message has been edited by Robert Buster (edited 02-03-2005).] |
||||
|
No,
BSTRIP only removes spaces from the beginning & end of the string: ITRIM also replace multiple spaces within the string with one: (<SPACE>A<SPACE><SPACE><SPACE>A<SPACE> ) ITRIM gives (A<SPACE>A) Greetings Robert |
||||
|
OK great.
To the forum: Does it make sense to integrate such a function into VIPP ? Can you give some use cases where it may be useful ? Thanks. |
||||
|
Yeah,
I think integration might be usefull. Imagine you have a name from 3 strings, then you do something like this: ($$TITLE. $$FNAME. $$LNAME.) VSUB SHL If the field FNAME would be empty you get 2 spaces between TITLE and LNAME. ITRIM solves this: ($$TITLE. $$FNAME. $$LNAME.) VSUB ITRIM SHL You can use it for anything, includeing the cases where you used to use BSTRIP. Greetings Robert |
||||
|
Hi
Did this ever get implemented? This would also be hand if you could choose the character that you would like to trim. |
||||
|
Hi
Did this ever get implemented? I can't find any function that does this in 7.0 Regards, Wim |
||||
|
It's called BTRIM and it has been there since VII 4.0 (end 2005). Documented in the readme and reference manual.
In addition the REPLACE transform (introduced in VII 6.0a) can also be handy to perform character replacement. |
||||
|
I mean the 'ITRIM' function BSTRIP only removes spaces before and at the end.
What to use in this case:
|
||||
|
The final name of the function is BTRIM not ITRIM. Use
($$TITLE. $$FNAME. $$LNAME.) VSUB BTRIM SHL |
||||
|
| Powered by Eve Community |
| Please Wait. Your request is being processed... |
|

