首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

拆分字符串有关问题

2012-01-02 
拆分字符串问题字符串strabc||bce||CC如何按||拆分,谢谢![解决办法]顶朋友 看看这个问题。http://communit

拆分字符串问题
字符串str=   abc||bce||CC   如何按||拆分,谢谢!

[解决办法]

朋友 看看这个问题。http://community.csdn.net/Expert/topic/5686/5686047.xml?temp=.8212702

[解决办法]
str.Split( '\|\| ');
[解决办法]
如果是在2005下

string str = "abc||bce||CC ";
string[] result = str.Split(new string[] { "|| " }, StringSplitOptions.RemoveEmptyEntries);

2003下用Regex.Split方法

[解决办法]
str.Split( "|| ");

[解决办法]
string sourceString = "abc||bce||CC ";
string pattern = @ "\|\| ";
string[] results = Regex.Split(sourceString,pattern);
foreach (string result in results)
{
WL(result);//输出
}

热点排行