trim a single quote from string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been trying to use TrimEnd() to eliminate a single quote from the end
of a string. I have used "'", ''', and a few others without success. Does
anyone have experience with TrimEnd()?
 
The method takes an array of characters as its argument.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.
 
How to define an array of characters ?

Kevin Spencer said:
The method takes an array of characters as its argument.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.
 
Alan T said:
How to define an array of characters ?

In the case of TrimEnd, you can specify the array just by giving the
characters, or the single character in your case:

x.TrimEnd ('\'');

That's because the parameter is declared with the "params" modifier.
Otherwise you'd have to do:

x.TrimEnd (new char[] { '\'' });

I would *strongly* recommend that if you're still fairly unfamiliar
with C# that you lean the basics thoroughly before moving onto things
like threading and GUI code. Threading can be tricky at the best of
times, but you'll find it a lot harder if you're still trying to get to
grips with the language itself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top