|
@@ -373,4 +373,42 @@ public class EntityProcess {
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ public String[] extract_digit_new(String value) {
|
|
|
+ String[] res = new String[2];
|
|
|
+ try {
|
|
|
+ String reg_time = "([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])";
|
|
|
+ Pattern pattern = Pattern.compile(reg_time);
|
|
|
+ Matcher matcher = pattern.matcher(value);
|
|
|
+ if (matcher.find(0)) {
|
|
|
+ res[0] = matcher.group(1);
|
|
|
+ res[1] = value.substring(value.indexOf(res[0]) + res[0].length());
|
|
|
+ } else {
|
|
|
+ res[0] = value;
|
|
|
+ res[1] = "";
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String value = "℃";
|
|
|
+ String[] res = new String[2];
|
|
|
+ try {
|
|
|
+ String reg_time = "([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])";
|
|
|
+ Pattern pattern = Pattern.compile(reg_time);
|
|
|
+ Matcher matcher = pattern.matcher(value);
|
|
|
+ if (matcher.find(0)) {
|
|
|
+ res[0] = matcher.group(1);
|
|
|
+ res[1] = value.substring(value.indexOf(res[0]) + res[0].length());
|
|
|
+ } else {
|
|
|
+ res[0] = value;
|
|
|
+ res[1] = "";
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|