Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Dear All;

I need to remove a single quotation at the end of one string...

For ex : string AA="Something'"

So here i need to remove the End character single quotation using TrimEnd() or however may be..

Pls help me to get the solution,.. Thanks in advance. :-)
Posted

Hi Ganesh,

See example:

C#
public static void Main()
{
  string sentence = "The dog had a bone, a ball, and other toys.";
  char[] charsToTrim = {',', '.', ' '};
  string[] words = sentence.Split();
  foreach (string word in words)
     Console.WriteLine(word.TrimEnd(charsToTrim));
}

// The example displays the following output: 
//       The 
//       dog 
//       had 
//       a 
//       bone 
//       a 
//       ball 
//       and 
//       other 
//       toys



Cheers,
Edo
 
Share this answer
 
v2
Comments
MT_ 21-Jan-13 5:43am    
+5
Joezer BH 21-Jan-13 5:44am    
Tnx ;)
Hi,

Try below code.
C#
char[] charTrim= {'\''};
AA.TrimEnd(charTrim)

Hope this will help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900