Test the last char of the string using String.IndexOfAny(Char[], Int32)
method (assuming str
is your variable):
str.IndexOfAny(new char[] {'+', '-', '*', '/'}, str.Length - 1)
Complete expression:
str.Lenght > 0 ? str.IndexOfAny(new char[] {'+', '-', '*', '/'}, str.Length - 1) != -1 : false