解析Path方法备忘
public static String parseDataPath(String dataPath){
StringBuilder parseBld = new StringBuilder();
List<String> parseLst = new ArrayList<String>();
if( StringUtils.isNotEmpty(dataPath) ){
String[] parseArry = dataPath.split("/");
int len = parseArry[1].length(); // 获取“20140220806501”这样数据的长度
for(int i=1; i<parseArry.length;i++){
String xx = dataPath.substring(0, (len*i+i+1));
parseLst.add("'"+xx+"'");
}
for(int i=0; i< parseLst.size(); i++){
if(i==parseLst.size()-1){
parseBld.append(parseLst.get(i));
}else{
parseBld.append(parseLst.get(i)+",");
}
}
}else{
}
return parseBld.toString();
}
可以实现将字符串:
/20140220806501/20140220806502/20140220806503/20140220806504/
解析成为:
'/20140220806501/20140220806502/20140220806503/20140220806504/','/20140220806501/20140220806502/20140220806503/','/20140220806501/20140220806502/','/20140220806501/'
二:将-140730982082800001-140730988144500002-140731029298300010-格式的解析成为:
-140730982082800001-
-140730982082800001-140730988144500002-
-140730982082800001-140730988144500002-140731029298300010-
使用如下代码:
private static List<String> analysisPath(String modelPath){
List<String> pathLst = new ArrayList<String>();
if( StringUtils.isNotEmpty(modelPath) ){
// -140730982082800001-140730988144500002-140731029298300010-
String[] tempArryPath = modelPath.split("-");
int len = tempArryPath[1].length(); // 获取140730982082800001的长度
for(int i=1; i < tempArryPath.length; i++ ){
String tempPath = modelPath.substring(0,(len*i+i+1));
pathLst.add(tempPath);
}
}
return pathLst;
}
解析Path方法备忘的更多相关文章
- ExtJs4常用配置方法备忘
viewport布局常用属性 new Ext.Viewport({ layout: "border", renderTo: Ext.getBody(), defaults: { b ...
- AR9331出现connect-debounce failed,port 1 disabled解决方法备忘
基于AR9331的路由器,自己画的pcb板子,居然出现这个错误,百度下,貌似有不少人遇见过这个错误,可是在改动板子前我的固件用的是没问题的.USB完美使用 改动过板子后出现这个问题! hub 1-0: ...
- Asp.Net调试方法备忘
由于种种原因导致vs不能启用Web服务器调试.可用如下方法来执行调试. 1.在vs中选择 调试>启动不调试(ctr+f5), 2.设置你需调试的相关断点,然后选择 调试>进程.选择Aspn ...
- JAVA中获得一个月最大天数的方法(备忘)
Calendar 类是一个抽象类,为日历字段之间的转换提供了一些方法.其中有一个重要方法 getActualMaximum ,该方法用于返回指定日历字段实际的最大值. 利用这个方法(Calendar. ...
- python常用函数和方法 - 备忘
语法语句篇 除法运算(精确运算和截断运算) 在python2中,除法运算通常是截断除法.什么是截断除法: >>> 3/4 0 # 自动忽略小数项 要是想 得到正确结果 怎么办呢? m ...
- C++-二维vector初始化大小方法-备忘
来源: C++——二维vector初始化大小方法 1.直接用初始化方法 名字为vec,大小为n*m,初始值为0的二维vector. vector<vector<)); 2.用resize( ...
- Synergy 使用方法备忘
Synergy 是 Symless 公司推出的「鼠标键盘共享软件」(mouse and keyboard sharing software),其功能还包括「共享剪贴板」(sharing clipboa ...
- jquery中的ajax方法(备忘)
参考:https://www.cnblogs.com/tylerdonet/p/3520862.html w3school:http://www.w3school.com.cn/jquery/ajax ...
- [Jquery] 获取地址栏参数的方法 备忘
<script type="text/javascript"> (function ($) { $.getUrlParam = function (name) { va ...
随机推荐
- 关于JS的一点summary
AJAX Application AJAX--->XML.HTML.JavaScript.JSON.Text.JSONP等数据. 同时代码即业务. code--->Business log ...
- [AngularJS] Using Services in Angular Directives
Directives have dependencies too, and you can use dependency injection to provide services for your ...
- [AngularJS] Accessing Scope from The Console
Using Angular, you can actually access the scope and other things from the console, so when you have ...
- iOS开发——UI篇Swift篇&玩转UItableView(三)分组功能
UItableView分组功能 class UITableViewControllerGroup: UIViewController, UITableViewDataSource, UITableVi ...
- String当中的高效函数(优化)
1. indexOf()函数是一个执行速度非常快的函数,可以用其与subString()实现高效的字符串分割,比内置的要高效. 2. charAt()方法也是高效率的函数,可以用其实现高效的start ...
- linux下的十六进制编辑器---wxHexEdit
....其实wxHexEdit是一个跨平台的十六进制编辑器,支持windows,linux,mac. 之所以标题用linux...是因为windows下多数都用winhex,UE之类的编辑器,而lin ...
- 深入理解Redis中的主键失效及其实现机制
参考:http://blog.sina.com.cn/s/articlelist_1221155353_0_1.html 作为一种定期清理无效数据的重要机制,主键失效存在于大多数缓存系统中,Reids ...
- 100%会用到的angularjs的知识点【新手可mark】
前言:下面我将整理出100%会到的angularjs的知识点,掌握这些知识点你基本上就可以独立完成一个angularjs的项目,前提是你有一定web开发的经验:1.了解基本的javascript的概念 ...
- python--Subprocess模块
The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, ...
- 1.4.2 solr字段类型--(1.4.2.2)solr附带的字段类型
1.4.2 solr字段类型 (1.4.2.1) 字段类型定义和字段类型属性. (1.4.2.2) solr附带的字段类型 (1.4.2.3) 使用货币和汇率 (1.4.2.4) 使用Dates(日期 ...