Remove single quote from strings

I would like to remove single quote from beginning and end of this string;

string tabName = "'i# milestones$'";
string outputTabName = tabName.Trim(new char[]{(char)39});

Where (char)39 represents ', and the .Trim() will remove the first and last ' from the string; You can try like this as well:

string outputTabName = tabName.Trim('\'');

FavoriteLoadingAdd to favorites
Spread the love

Author: Shahzad Khan

Software developer / Architect