Focal Point
Remove trailing spaces from GETTOK

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7631018331

November 18, 2004, 02:53 PM
<kvn>
Remove trailing spaces from GETTOK
I've tried STRIP, TRIM, and SQUEEZ to rid of the trailing spacings. I even tried using 'A0' as the output type. When I output the length of the first token I keep getting length of 17. I'm trying to get the length of each token. Any hints on accomplishing this task.




-DEFAULT &tmplst = '1324# 5678A# 9101# 1121BC#';

-SET &tokval=GETTOK(&tmplst, &tmplst.LENGTH, 1, '#', 1, A0);

This message has been edited. Last edited by: <Mabel>,
November 18, 2004, 03:30 PM
susannah
there aren't any trailing spaces in your example.
November 18, 2004, 04:43 PM
<Pietro De Santis>
Try this:

-DEFAULT &TMPLST = '1324# 5678A# 9101# 1121BC#';
-SET &TOKVAL = GETTOK(&TMPLST, &TMPLST.LENGTH, 1, '#', &TMPLST.LENGTH, 'A.&TMPLST.LENGTH');
-TYPE X &TOKVAL X &TOKVAL.LENGTH

-SET &TOKVAL2 = TRIMV('B', &TOKVAL, &TOKVAL.LENGTH, ' ', 1, 'A99V');
-TYPE X &TOKVAL2 X &TOKVAL2.LENGTH
November 18, 2004, 05:43 PM
<kvn>
Thanks Pietro De Santis. Worked great. I tried using TRIMV before but with no luck. What does 'A99V' mean?
November 18, 2004, 05:55 PM
<Pietro De Santis>
I didn't even know TRIMV existed. It's quite interesting.

In the Using Functions manual, there's a chapter called "Character Functions for AnV Fields".

A99V appears to be be a database field that is variable length, with a maximum length of 99. What's really interesting is this format can be used in a Dialog Manager function call.

This allows the TRIMV command to actually trim the DM variable. The regular TRIM command requires a field length as the last piece of the function string, thus nullifying what it's used for, if you're trimming spaces.