Chinaunix首页 | 论坛 | 博客
  • 博客访问: 12751542
  • 博文数量: 1293
  • 博客积分: 13501
  • 博客等级: 上将
  • 技术积分: 17974
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-08 18:11
文章分类

全部博文(1293)

文章存档

2019年(1)

2018年(1)

2016年(118)

2015年(257)

2014年(128)

2013年(222)

2012年(229)

2011年(337)

分类: Java

2014-12-23 10:19:52

JAVA:
int lastIndex = subPath.lastIndexOf("/");

C#:
fileNameList[i].Substring(fileNameList[i].LastIndexOf('/') + 1);

string fileName = pictureBox1.ImageLocation.Substring(pictureBox1.ImageLocation.LastIndexOf("\\") + 1);

用法是一样的。
这里需要注意的是,正斜杠和反斜杠在作SubString截断符时的写法:
一个需要转义,一个不需要转义!!!!

参考文献:
http://www.cnblogs.com/leehongee/p/3324062.html
阅读(4232) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~