cancel
Showing results for 
Search instead for 
Did you mean: 

Trim functions not working ?

Former Member

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

Accepted Solutions (1)

Accepted Solutions (1)

SergioG_TX
Active Contributor
0 Kudos

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)

Answers (1)

Answers (1)

Former Member
0 Kudos

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("-","")
Former Member
0 Kudos

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