Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6080889
  • 博文数量: 2759
  • 博客积分: 1021
  • 博客等级: 中士
  • 技术积分: 4091
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-11 14:14
文章分类

全部博文(2759)

文章存档

2019年(1)

2017年(84)

2016年(196)

2015年(204)

2014年(636)

2013年(1176)

2012年(463)

分类: Java

2014-12-28 11:28:03

原文地址:C#与Java的String.lastIndexOf 作者:dyli2000

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
阅读(1397) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~