Remove last character if it's a backslash

Viewed 89330

Is there a function to chomp last character in the string if it's some special character? For example, I need to remove backslash if it's there, and do nothing, if not. I know I can do it with regex easily, but wonder if there something like a small built-in function for that.

8 Answers

For C# people who end up here:

my_string = my_string.TrimEnd('\\');
Related