· Aug 12, 2020

Remove Trailing Squares from String


     Can anyone please explain me how to remove trailing squares from the text field (String). Trailing squares is a white space ?

I tried different things like Ltrim, Trim from sql query side and also from object scripting side something below.

 If Address1 set Address1 = $ZSTRIP(Address1,"<>P,<>C,<>W")
 If Address1 set Address1 = $ZSTRIP(Address1,"$C(9), $C(32), $C(160)")
 If Address1 set Address1 = $ZSTRIP(Address1,"*W,*C")

Nothing works for me

Can anyone please help me to solve this



Discussion (5)3
Log in or sign up to continue

While I agree that you need to identify the ascii value of the characters you have at the end, I do want to note that to remove trailing whitespaces, the syntax is $zstrip(x,">W")

Using that removes trailing whitespaces as you can see in the example below.  Additionally, to add the stripping of "control characters" you would just add the C, so $zstrip(x,">WC")

>set x = "  apple   "
>write "/" _ $zstrip(x,">W") _ "/"
/  apple/