asp.net(c#)中分割字符串的几种方法
来源:互联网 发布:淘宝大学女装推荐 知乎 编辑:程序博客网 时间:2024/06/09 06:45
单个字符分割
string s="abcdeabcdeabcde";
string[] sArray=s.Split('c');
foreach(string i in sArray)
Console.WriteLine(i.ToString());
输出下面的结果:
ab
deab
deab
de
多个字符分割
string s="abcdeabcdeabcde
string[] sArray1=s.Split(new char[3]{'c','d','e'});
foreach(string i in sArray1)
Console.WriteLine(i.ToString());
可以输出下面的结果:
ab
ab
ab
多个字符分割(正则表达式)
string content="agcsmallmacsmallgggsmallytx";
string[]resultString=Regex.Split(content,"small",RegexOptions.IgnoreCase)
foreach(string i in resultString)
Console.WriteLine(i.ToString());
输出下面的结果:agc
mac
ggg
ytx
- asp.net(c#)中分割字符串的几种方法
- c#中分割字符串的几种方法
- 转贴(CSDN):c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- CSocket类网络通信编程步骤
- python 编译成可运行的 .pyc /pyo文件
- ASP.NET 应用中上传大文件
- Xerces-C++ 编程指南
- left join/right join/inner join操作演示
- asp.net(c#)中分割字符串的几种方法
- PYTHON+APACHE的方法及注意事项
- 20070928听力原文
- ASP.NET2.0中Gridview中的内容导出到Excel
- MSSQL常用汇总
- python连接MYSql数据库python连接MYSql数据库 使用 MySQLdb
- 美国热剧《越狱》人物分析
- Ajax 和 XML: 五种常见 Ajax 模式
- [Web]完全 Div 实现 页面居中、多行多列等 排版实例