linux window共用方法路径分割

regex为\\\\,因为在java中\\表示一个\,而regex中\\也表示\,所以当\\\\解析成regex的时候为\\。 由于unix中file.separator为斜杠"/",下面这段代码可以处理windows和unix下的所有情况: String temp[] = name.replaceAll("\\\\","/").split("/"); if (temp.length > 1) { name = temp[temp.length - 1]; }

posted on 2014-08-14 14:43 youngturk 阅读(235) 评论(0)  编辑  收藏 所属分类: Java基础


只有注册用户登录后才能发表评论。


网站导航:
 
<2014年8月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

导航

统计

公告

this year :
1 jQuery
2 freemarker
3 框架结构
4 口语英语

常用链接

留言簿(6)

随笔分类

随笔档案

文章分类

文章档案

相册

EJB学习

Flex学习

learn English

oracle

spring MVC web service

SQL

Struts

生活保健

解析文件

搜索

最新评论

阅读排行榜

评论排行榜