Monday, March 15, 2021

Trim last character from a string or each word C#


Input:
I have a string say 
"Hello! world!" 
I want to do a trim or a remove to take out the ! off world but not off Hello.
Solution:
"Hello! world!".TrimEnd('!');


No comments: