您的位置:首页 > 运维架构 > Linux

截取linux文件存储路径方法

2016-05-21 09:54 447 查看
1.截取linux文件存储路径方法

package com.tydic.eshop.action.freemarker;

public class dddd {

public static void main(String[] args) {
String strParentUrl = "/home/tomcat7/ecp/t8086/webapps/ecp/FreeMarker/1463766670142/error/html/index.html";
String[] s = strParentUrl.split("/");
String ddd = display(s,8,s.length);
System.out.println(ddd);

}

public static String display(String[] str,int a,int b) {
StringBuffer sb = new StringBuffer();
for(int i=a;i<b;i++) {
sb.append("/"+str[i]);
}
String requestString = sb.toString().substring(1, sb.toString().length());
return requestString;

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: