关于字符串的截断(根据换行符)?

Zoezs 2009-02-02 04:38:33
我想把字符串截断,根据换行符,直接用split("\r\n")可以吗?
...全文
392 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
hhb520tina 2011-11-30
  • 打赏
  • 举报
回复
SDF
maochenai 2011-09-15
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 wuyi8808 的回复:]

引用 6 楼 Zoezs 的回复:
谢谢,二楼的可以,一楼的少了点东西。


C# code
string input = "第一行\r\n第二行\r\n。。。";
string [] output = System.Text.RegularExpressions.Split(input, @"\r\n");
[/Quote]
string [] output = System.Text.RegularExpressions.Regex.Split(input, @"\r\n");
dtzh420 2011-03-16
  • 打赏
  • 举报
回复
为了看2楼的代码,回复下
Jchuyang 2011-02-18
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 xiaowen888666 的回复:]
引用 7 楼 wuyi8808 的回复:

引用 6 楼 Zoezs 的回复:
谢谢,二楼的可以,一楼的少了点东西。


C# code
string input = "第一行\r\n第二行\r\n。。。";
string [] output = System.Text.RegularExpressions.Split(input, @"\r\n");
[/Quote]
xiaowen888666 2011-02-18
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 wuyi8808 的回复:]

引用 6 楼 Zoezs 的回复:
谢谢,二楼的可以,一楼的少了点东西。


C# code
string input = "第一行\r\n第二行\r\n。。。";
string [] output = System.Text.RegularExpressions.Split(input, @"\r\n");
[/Quote]
wuyi8808 2009-02-02
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 Zoezs 的回复:]
谢谢,二楼的可以,一楼的少了点东西。
[/Quote]

string input = "第一行\r\n第二行\r\n。。。";
string [] output = System.Text.RegularExpressions.Split(input, @"\r\n");
Zoezs 2009-02-02
  • 打赏
  • 举报
回复
谢谢,二楼的可以,一楼的少了点东西。
zgke 2009-02-02
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 min_jie 的回复:]
喔,慢了。。
[/Quote]
比你更慢的.
止戈而立 2009-02-02
  • 打赏
  • 举报
回复
喔,慢了。。
zgke 2009-02-02
  • 打赏
  • 举报
回复
.Split(new char[] {'\r','\n' },StringSplitOptions.RemoveEmptyEntries);
止戈而立 2009-02-02
  • 打赏
  • 举报
回复
System.Text.RegularExpressions.Regex.Split("你的字符串",@"\r\n")
wuyi8808 2009-02-02
  • 打赏
  • 举报
回复
string [] output = System.Text.RegularExpressions.Split(input, @"\r\n");

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧