|
@@ -2,6 +2,7 @@ package com.winhc.bigdata.udf;
|
|
|
|
|
|
import com.aliyun.odps.udf.UDF;
|
|
|
import com.aliyun.odps.utils.StringUtils;
|
|
|
+import jdk.nashorn.internal.runtime.regexp.joni.Regex;
|
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
@@ -10,18 +11,19 @@ import java.util.regex.Pattern;
|
|
|
* @Description: 统一分割符
|
|
|
*/
|
|
|
public class StringReplaceChar extends UDF {
|
|
|
- private static final Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa50-9a-zA-Z]");
|
|
|
|
|
|
public String evaluate(String val) {
|
|
|
return StringUtils.isNotBlank(val) ? val.replaceAll("、",",")
|
|
|
.replaceAll(";",",")
|
|
|
.replaceAll(",",",")
|
|
|
.replaceAll(" ",",")
|
|
|
+ .replaceAll(":",",")
|
|
|
+ .replaceAll(":",",")
|
|
|
: "";
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- String res = new StringReplaceChar().evaluate("中国,人123;za 早上5");
|
|
|
+ String res = new StringReplaceChar().evaluate("中国,人123;za 早上5:xx");
|
|
|
System.out.println(res);
|
|
|
}
|
|
|
}
|