可能重复:
Truncate string on whole words in .Net C#如何显示字符串最多200个字符和剪裁过去的几年charaters直到空白
我必须要显示的消息简要说明让我们说最多200个字符&修剪过去的几个字符,直到空格,我不知道我怎么可以在字符串上这样的行程
Sample te与代码XT
sample news description of news sample news description of news sample news description of news sample news description of news sample news description of news sample news description of news sample news description of news.
低于输出
sample news description of news sample news description of news sample news description of news sample news description of news sample news description of news sample news description of news sample n
if (sDesc.Length > 200)
{
sDesc = sDesc.Substring(0, 200);
// sDesc = sDesc + "...";
}
我怎样才能最后几个字符修剪,这样它不会显示字的一部分。我希望你明白我想说的是什么。的的的的的新闻样品新闻样品新闻说明新闻样品新闻说明新闻样品新闻说明新闻样品新闻说明新闻样品新闻描述
所需的输出
样品新闻描述
这个问题已经有了很好的答案。请参阅http://stackoverflow.com/a/1614090/445650 –
@ Kavin,很好完成..谢谢.. – Learning