Need to cut string and remove part after 2nd "-"

I have many strings of this format “100-99090000-02” and i want to take out the part after the second “-” and the 2nd “-” itself. How would i do that. I am unsure if the length of the string will change later so i cannot just simply trim the string according to the last 3 characters.

@eric_wai

You use Split and substring to do this

ArrayVariable = YourString.Split("-"c)

Give me your desired output

Mark as solution if this helps

@ksrinu070184

my desired output is “100-99090000”

@eric_wai

ArrayVariable = YourString.Split("-")

StringVariable = ArrayVariable(0) + “-” + ArrayVariable(1)

Mark as solution if this helps

Thanks

@ksrinu070184

Ahh i think i see the logic here. Thanks beforehand. Ill mark it the solution when it works

:slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.