c#中分割字符串的几种方法
来源:互联网 发布:3d动态桌面软件 编辑:程序博客网 时间:2024/05/31 11:03
c#中分割字符串的几种方法
单个字符分割
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
- c#中分割字符串的几种方法
- 转贴(CSDN):c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- c#中分割字符串的几种方法
- C#中分割字符串的几种方法
- 双机调试的发展
- My First Day in CSDN
- using System.Management; Get CPUID,IP,MACaddress,DISK ID
- JDBC连接SQL Server 2000
- 安装SQL2k时,提示“以前的某个程序已在电脑上安装了挂起文件,需重新启动电脑”的解决方法
- c#中分割字符串的几种方法
- Java web 开发必游之路
- C#实现网段扫描
- typedef与#define的区别
- 用MFC做VS起始页界面
- 保证你现在和未来不失业的十种关键技术
- 数据库访问通用类(封装)示例1
- [转]基于JSON的高级AJAX开发技术
- 收集一些基础的常用的方法及函数