博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
字符串分隔
阅读量:7090 次
发布时间:2019-06-28

本文共 773 字,大约阅读时间需要 2 分钟。

       字符串分隔的各种类型:

            //string s = "hello";

            //char[] chars = s.ToCharArray();
            //chars[0] = 'a';
            //string s1 = new string(chars);
            //Console.WriteLine(s1);
            //bool b = "abc".Equals("ABC",StringComparison.OrdinalIgnoreCase);
            //Console.WriteLine(b);

            //int i = "123".CompareTo("abc");

            //Console.WriteLine(i);
            //Console.ReadKey();
            //string s = "abc,hec,ccc,,fff";
            //string[] strs = s.Split(new char[]{','},StringSplitOptions.RemoveEmptyEntries);
            //foreach (string s1 in strs)
            //{
            //    Console.WriteLine(s1);
            //}
            //Console.ReadKey();
            string s = "我是周杰伦我是刘德华我是韩庚";
            string[] strs = s.Split(new string [] { "我是" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string s1 in strs)
            {
                Console.WriteLine(s1);
            }
            Console.ReadKey();

转载于:https://www.cnblogs.com/wangyhua/archive/2011/12/20/4050682.html

你可能感兴趣的文章
convert time-24小时制转换为12小时制
查看>>
MISP2:初始阶段
查看>>
在Linux下创建空文件的方法
查看>>
项目整体管理
查看>>
打算搭建一个***视频下载网站
查看>>
Skype for Business Server 2015-04-前端服务器-7-部署
查看>>
我的友情链接
查看>>
django使用rest_framework API认证
查看>>
背景图片百分之百大小css设置方法
查看>>
SQL 语句中的With(index())
查看>>
我的友情链接
查看>>
修改计算机名后arcgis设置
查看>>
揭密HTML5带来的攻击手法
查看>>
php脚本超时时间设置
查看>>
DPM2012学习(十一),裸机还原域控制器
查看>>
SQL2005学习(二十五),插入单行数据
查看>>
bootstrap-fileinput提交多张图片时只获取到一张
查看>>
RedHat 正在决定 eth0 的 IP 信息...失败;无链接。检查电缆吗?
查看>>
我眼中的德国攻城师
查看>>
Linux Mail基本服务器构建之postfix源码安装(下)
查看>>