博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C#中使用split分割字符串的几种方法
阅读量:6934 次
发布时间:2019-06-27

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

hot3.png

C#中使用split分割字符串的几种方法- - 

 
第一种方法: 

string s=abcdeabcdeabcde;string[] sArray=s.Split('c') ;foreach(string i in sArray)Console.WriteLine(i.ToString());

 

输出结果: 

 
ab 
deab 
deab 
de 

其他方法http://blog.csdn.net/leeharry/article/details/2281325

实现gridview点击行触发事件

protected void GridView2_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)    {        string id = GridView2.DataKeys[e.NewSelectedIndex].Value.ToString();        //编写SQL语句查询当前选中的文件的文件名title字段        string sql = "select title from filepath where id=" + id;        //调用公共类中的getTier方法获取视频的审核状态        string title = BaseClass.getOut(sql);        string[] array = title.Split('.');//split方法分割字符串        string title2=array[0];        string doc = "~\\officeroot\\" + title;        string swf = "~\\swfroot\\" + title2+"asas.swf";        ConvertPdfToSwf(doc, swf);       System.Threading.Thread.Sleep(8000);        FileInfo file = new FileInfo(Server.MapPath(swf));//判断格式转换后的文件是否存在        if (file.Exists)        {            Response.Write("
alert('上传成功!' )");//弹出提示信息         }        else        {            Response.Write("
alert('上传失败!' )");//弹出提示信息         } }

转载于:https://my.oschina.net/SnifferApache/blog/114216

你可能感兴趣的文章
网站设计失败原因积累
查看>>
imread() not working in OpenCV 2.4.11 Debug mode
查看>>
spring源码分析之spring-messaging模块详解
查看>>
2015第17周六去除表中某字段重复记录
查看>>
HI3518E用J-link烧写裸板fastboot u-boot流程
查看>>
深入浅出OOP(五): C#访问修饰符(Public/Private/Protected/Internal/Sealed/Constants)
查看>>
浪淘沙
查看>>
纯CSS3悬停图标旋转导航动画代码
查看>>
The YubiKey -- HOW IT WORKS
查看>>
Jquery easyui Tree的简单使用
查看>>
【Oracle学习笔记-1】Win7下安装Oracle 10g
查看>>
微信公众平台应用开发:方法、技巧与案例--柳峰,Java语言版本
查看>>
Softmax回归
查看>>
自己开发Visual studio插件-一个nvelocity高亮插件
查看>>
信息与网络安全需要大数据安全分析
查看>>
Android App data write as file data with synchronous Demo
查看>>
《C++ Primer Plus》学习笔记6
查看>>
基于D3JS绘制中国地图
查看>>
JAVA面试题:69道Spring面试题和答案
查看>>
php -- PDO属性设置
查看>>