本文介绍了如何使用TrimEnd()删除单个引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人;



我需要删除一个字符串末尾的单引号...



例如:字符串AA =Something''



所以这里我需要使用TrimEnd()删除End字符单引号,或者可能是..



请帮我解决问题,...提前致谢。 : - )

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. :-)

推荐答案

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







干杯,

Edo




Cheers,
Edo


char[] charTrim= {'\''};
AA.TrimEnd(charTrim)



希望这会对你有帮助。


Hope this will help you.


这篇关于如何使用TrimEnd()删除单个引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 08:01