Trim last character if not a number
I'm trying to trim out the last charater from a string if not a number For example : "2+3-4*" From there last astrik needs to be trimmed as it is not a number my result should be as "2+3-4". If user enters "2+3+8" then no needs to trim as the last is number.
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Asma KhalidRank #160 · 14.7K reputationPosted Feb 20, 2017, 9:56 PM EST
if (!char.isDigit(stVal[stVal.Length-1]))
{
Amit GuptaRank #190 · 12.8K reputationPosted Feb 20, 2017, 8:26 AM EST
Rafnas T PRank #280 · 8.8K reputationPosted Feb 20, 2017, 6:09 PM EST