Remove unwanted character at the end of the stringvariable

Hi Can any one help me to find a solution for the below
Str_variable=“26-09-2020-”
i need to remove only the “-” at the end

str = str.Substring(0, str.Length-1)

this should work for you str_variable = str_variable.Trim("-"c)

1 Like

Try to get the required date\string using Regex method.
Regex.Match(Str_variable,“\d±\d±\d+”).Value.ToString.

1 Like

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