removing single quote from end of a string in C#

c#

Solution

You could use another trim:

importTabs.Add(row["TABLE_NAME"].ToString().Trim('\'').TrimEnd('$')

Or, if you don't mind removing the `$` at the beginning too, you can do it all at once:

importTabs.Add(row["TABLE_NAME"].ToString().Trim('\'', '$')

That saves you from creating one more string instance than you need to.

Problem

i am using the following code : ``` importTabs.Add(row["TABLE_NAME"].ToString().TrimEnd('$') ``` to remove a dollar from string stored in importTabs Array list. how do i pass a parameter along with '$' so that it removes a single quote (') from the beginning ans well the end of the string?

Original source