Skip to Content
0

Trim functions not working ?

Aug 18, 2017 at 01:54 PM

99

avatar image

Hello Experts,

I tried to trim my ID as in the attached. Surprisingly, standard trim function fails to work.

Anybody experiences same thing or am I doing wrong, kindly let me know.

Regards,

Senthil

trim.png (120.4 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Sergio Guerrero Aug 18, 2017 at 02:13 PM
0

the Trim function removes empty spaces on both sides of the string.

depending on what you need to do, you may be able to split on the - character and then read the left side (index 0) or the right side (index 1)

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Aug 18, 2017 at 10:07 PM
0

I do not think you understand how trim works... it is not a "Replace" or a "Remove" from anywhere in the string

Trim left removes the char from the left only (right is the same only right)

Trim("-") would only remove the "-" from the left and the right not the middle

Trim on its own only removes " " spaces from the left and right as sergio mentioned.. so

If you are looking to Remove the "-" try

.Replace("-","")
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks for the clarification Gast,

I misunderstood the trim left would remove all the characters before "-" like,

input : "117-25"

trim left output: "25"

trim right output: "117"

So I used findPosition and SubString function to get the above results. Is there any other function to get the desired result?

Regards,

Senthil

0