|
@@ -539,7 +539,7 @@ public class CustomFunction {
|
|
|
public static String createStation(Object stationType) {
|
|
|
if(StringUtils.isNotEmpty(stationType)) {
|
|
|
|
|
|
- Matcher m = matcher("[~|-]",handleNull(stationType));
|
|
|
+ Matcher m = RegexUtils.matcher("[~|-]",handleNull(stationType));
|
|
|
if(m.find()){
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
String splitchar = m.group(0);
|
|
@@ -557,10 +557,6 @@ public class CustomFunction {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
- public static Matcher matcher(String regex, String value) {
|
|
|
- Pattern pattern = Pattern.compile(regex);
|
|
|
- return pattern.matcher(value);
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* @Description 记录表5输入桩号代码解析,2G1#1+100>>2G1K0+100
|
|
@@ -575,7 +571,7 @@ public class CustomFunction {
|
|
|
String stakeStr = StringUtils.repaceBlank(stake.toString().toUpperCase());
|
|
|
Matcher m ;
|
|
|
if(stake.toString().contains("+")){
|
|
|
- m = matcher("(([A-Z0-9]*)(#\\d*)?)\\+([\\d||\\.]*)", stakeStr);
|
|
|
+ m = RegexUtils.matcher("(([A-Z0-9]*)(#\\d*)?)\\+([\\d||\\.]*)", stakeStr);
|
|
|
if(m.find()){
|
|
|
String partNoD = m.group(1);
|
|
|
String partNoV = m.group(2);
|
|
@@ -585,7 +581,7 @@ public class CustomFunction {
|
|
|
result[2]=kilometer;
|
|
|
}
|
|
|
}else{
|
|
|
- m =matcher("([A-Z]*)([\\d||\\.]*)", stakeStr);
|
|
|
+ m =RegexUtils.matcher("([A-Z]*)([\\d||\\.]*)", stakeStr);
|
|
|
if(m.find()){
|
|
|
String partNo = m.group(1);
|
|
|
String kilometer = m.group(2);
|
|
@@ -602,8 +598,8 @@ public class CustomFunction {
|
|
|
String[] result = new String[]{"",""};
|
|
|
if(StringUtils.isNotEmpty(stake)){
|
|
|
String stakeStr = StringUtils.repaceBlank(stake.toString().toUpperCase());
|
|
|
- Matcher m = matcher("([A-Z0-9]{0,3})K(\\d{1,3})\\+([\\d||\\.]*)", stakeStr);
|
|
|
- Matcher m2 = matcher("([A-Z]{0,3})([\\d||\\.]+)", stakeStr);
|
|
|
+ Matcher m = RegexUtils.matcher("([A-Z0-9]{0,3})K(\\d{1,3})\\+([\\d||\\.]*)", stakeStr);
|
|
|
+ Matcher m2 = RegexUtils.matcher("([A-Z]{0,3})([\\d||\\.]+)", stakeStr);
|
|
|
if(m.find()){
|
|
|
String partNo = m.group(1);
|
|
|
double km = Double.parseDouble(m.group(2));
|
|
@@ -632,7 +628,7 @@ public class CustomFunction {
|
|
|
if(StringUtils.isNotEmpty(n)){
|
|
|
String[] sa = n.toString().split(",");
|
|
|
for(String s:sa){
|
|
|
- Matcher m = matcher("(\\d)+.(\\d)+",s);
|
|
|
+ Matcher m = RegexUtils.matcher("(\\d)+.(\\d)+",s);
|
|
|
if(m.find()){
|
|
|
max=Math.max(new StringBuilder(m.group()).reverse().toString().indexOf("."),max);
|
|
|
}
|
|
@@ -1070,7 +1066,7 @@ public class CustomFunction {
|
|
|
* @Date 2021.09.17 14:31
|
|
|
**/
|
|
|
public static boolean containsZH(Object chars){
|
|
|
- Matcher m =matcher("[\u4e00-\u9fa5]",handleNull(chars));
|
|
|
+ Matcher m =RegexUtils.matcher("[\u4e00-\u9fa5]",handleNull(chars));
|
|
|
return m.find();
|
|
|
}
|
|
|
|
|
@@ -1082,7 +1078,7 @@ public class CustomFunction {
|
|
|
* @Date 2021.09.17 14:31
|
|
|
**/
|
|
|
public static boolean containsD(Object chars){
|
|
|
- Matcher m =matcher("\\d",handleNull(chars));
|
|
|
+ Matcher m =RegexUtils.matcher("\\d",handleNull(chars));
|
|
|
return m.find();
|
|
|
}
|
|
|
|
|
@@ -1172,7 +1168,7 @@ public class CustomFunction {
|
|
|
**/
|
|
|
public static Object dateFormatter(Object date,Object format){
|
|
|
if(StringUtils.isNotEmpty(date)&&StringUtils.isNotEmpty(format)){
|
|
|
- Matcher m = matcher("(\\d{4})\\D(\\d{2})\\D(\\d{2})日?\\s*(\\d{0,2})(\\D\\d{1,2})?",date.toString());
|
|
|
+ Matcher m = RegexUtils.matcher("(\\d{4})\\D(\\d{2})\\D(\\d{2})日?\\s*(\\d{0,2})(\\D\\d{1,2})?",date.toString());
|
|
|
if(m.find()){
|
|
|
String yyyy = handleNull(m.group(1));
|
|
|
String MM = handleNull(m.group(2));
|
|
@@ -1402,7 +1398,7 @@ public class CustomFunction {
|
|
|
}
|
|
|
if(!dateStr.contains("-")){
|
|
|
dateStr=StringUtils.repaceBlank(dateStr);
|
|
|
- Matcher m = matcher("\\d{4}(.)\\d{2}(.)\\d{2}(.?)",dateStr);
|
|
|
+ Matcher m = RegexUtils.matcher("\\d{4}(.)\\d{2}(.)\\d{2}(.?)",dateStr);
|
|
|
if(m.find()){
|
|
|
Set<String> set = new HashSet<>();
|
|
|
set.add(m.group(1));
|
|
@@ -1431,7 +1427,7 @@ public class CustomFunction {
|
|
|
return null;
|
|
|
}
|
|
|
if(!dateStr.contains("-")){
|
|
|
- Matcher m = matcher("\\d{4}(.)\\d{2}(.)\\d{2}(日?)",dateStr);
|
|
|
+ Matcher m = RegexUtils.matcher("\\d{4}(.)\\d{2}(.)\\d{2}(日?)",dateStr);
|
|
|
if(m.find()){
|
|
|
Set<String> set = new HashSet<>();
|
|
|
set.add(m.group(1));
|
|
@@ -1511,7 +1507,7 @@ public class CustomFunction {
|
|
|
|
|
|
|
|
|
public static Object k2d(Object k){
|
|
|
- Matcher mt = matcher("[A-Z]*(\\d*)\\+([\\d|\\.]*)",k.toString());
|
|
|
+ Matcher mt = RegexUtils.matcher("[A-Z]*(\\d*)\\+([\\d|\\.]*)",k.toString());
|
|
|
if(mt.find()){
|
|
|
return Double.parseDouble(mt.group(1))*1000+Double.parseDouble(mt.group(2));
|
|
|
}
|
|
@@ -2183,7 +2179,7 @@ public class CustomFunction {
|
|
|
String s = handleNull(e);
|
|
|
if(StringUtils.isNotEmpty(s)){
|
|
|
if(containsZH(s)){
|
|
|
- Matcher m =matcher("[\u4e00-\u9fa5]+(\\d+)\\D*合格(\\d+)\\D+",s);
|
|
|
+ Matcher m =RegexUtils.matcher("[\u4e00-\u9fa5]+(\\d+)\\D*合格(\\d+)\\D+",s);
|
|
|
if(m.find()){
|
|
|
checkpoints+=Integer.parseInt(m.group(1));
|
|
|
passpoints+=Integer.parseInt(m.group(2));
|
|
@@ -2598,7 +2594,7 @@ public class CustomFunction {
|
|
|
if(!StringUtils.isNumber(scale)){
|
|
|
scale=0;
|
|
|
}
|
|
|
- Matcher m = matcher("(-?\\d+(\\.\\d+)?)[h|H]?[,|,](\\+?\\d+(\\.\\d+)?)[h|H]?",dev.toString().replaceAll("[(|)]",""));
|
|
|
+ Matcher m = RegexUtils.matcher("(-?\\d+(\\.\\d+)?)[h|H]?[,|,](\\+?\\d+(\\.\\d+)?)[h|H]?",dev.toString().replaceAll("[(|)]",""));
|
|
|
if(list instanceof List&&m.find()){
|
|
|
List<Object> arrayList = (ArrayList<Object>) list;
|
|
|
double tick=0;
|
|
@@ -2834,7 +2830,7 @@ public class CustomFunction {
|
|
|
* @Date 2021.01.08 16:31
|
|
|
**/
|
|
|
public static Object matcherFindGroup(String regex, String value ,int i,boolean g){
|
|
|
- Matcher m = matcher(regex,value);
|
|
|
+ Matcher m = RegexUtils.matcher(regex,value);
|
|
|
List<Object> result = new ArrayList<>();
|
|
|
while (m.find()){
|
|
|
result.add(m.group(i));
|
|
@@ -2881,7 +2877,7 @@ public class CustomFunction {
|
|
|
}
|
|
|
}else{
|
|
|
List<Object> datas = Arrays.asList(o.toString().split("[、, ,]"));
|
|
|
- Matcher m = matcher("[、, ,]",o.toString());
|
|
|
+ Matcher m = RegexUtils.matcher("[、, ,]",o.toString());
|
|
|
String s="、";
|
|
|
if(m.find()){
|
|
|
s=handleNull(m.group());
|
|
@@ -2960,7 +2956,7 @@ public class CustomFunction {
|
|
|
for(int i=0;i<stakes.size();i++){
|
|
|
Object cp = stakes.get(i);
|
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
|
- Matcher m = matcher("(?i)zd\\d+",cp.toString());
|
|
|
+ Matcher m = RegexUtils.matcher("(?i)zd\\d+",cp.toString());
|
|
|
if(!m.find()){
|
|
|
result.add(dx.get(i));
|
|
|
}
|
|
@@ -2981,7 +2977,7 @@ public class CustomFunction {
|
|
|
if(StringUtils.isNotEmpty(bmd)){
|
|
|
for (Object cp : stakes) {
|
|
|
if (StringUtils.isNotEmpty(cp) && StringUtils.isNotEquals(bmd, cp)) {
|
|
|
- Matcher m = matcher("(?i)zd\\d+", cp.toString());
|
|
|
+ Matcher m = RegexUtils.matcher("(?i)zd\\d+", cp.toString());
|
|
|
if (!m.find()) {
|
|
|
result.add(cp);
|
|
|
}
|
|
@@ -3007,7 +3003,7 @@ public class CustomFunction {
|
|
|
for(int i=0;i<cds.size();i++){
|
|
|
Object cp = cds.get(i);
|
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
|
- Matcher m = matcher("(?i)zd\\d+",cp.toString());
|
|
|
+ Matcher m = RegexUtils.matcher("(?i)zd\\d+",cp.toString());
|
|
|
if(!m.find()){
|
|
|
if(StringUtils.isNumber(cp)){
|
|
|
result.add("");
|
|
@@ -3051,7 +3047,7 @@ public class CustomFunction {
|
|
|
for(int i=0;i<cds.size();i++){
|
|
|
Object cp = cds.get(i);
|
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
|
- Matcher m = matcher("(?i)zd\\d+",cp.toString());
|
|
|
+ Matcher m = RegexUtils.matcher("(?i)zd\\d+",cp.toString());
|
|
|
if(!m.find()){
|
|
|
if(StringUtils.isNumber(cp)){
|
|
|
dyn.add(handleNull(dxs.get(i)));
|
|
@@ -3084,7 +3080,7 @@ public class CustomFunction {
|
|
|
for(int i=0;i<cds.size();i++){
|
|
|
Object cp = cds.get(i);
|
|
|
if(StringUtils.isNotEmpty(cp)&&StringUtils.isNotEquals(bmd,cp)){
|
|
|
- Matcher m = matcher("(?i)zd\\d+",cp.toString());
|
|
|
+ Matcher m = RegexUtils.matcher("(?i)zd\\d+",cp.toString());
|
|
|
if(!m.find()){
|
|
|
if(StringUtils.isEquals(mode,0)){
|
|
|
if(!Pattern.matches(".+(?i)v$",cp.toString())){
|