Skip to Content

Trim functions not working ?

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Aug 18, 2017 at 02:13 PM

    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)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 18, 2017 at 10:07 PM

    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("-","")
    Add comment
    10|10000 characters needed 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