|
@@ -0,0 +1,29 @@
|
|
|
|
+package com.winhc.bigdata.udf;
|
|
|
|
+
|
|
|
|
+import com.aliyun.odps.udf.UDF;
|
|
|
|
+
|
|
|
|
+import java.util.regex.Matcher;
|
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @Author: XuJiakai
|
|
|
|
+ * @Date: 2020/5/19 11:34
|
|
|
|
+ * @Description: 跟据注册资本返回币种
|
|
|
|
+ */
|
|
|
|
+public class RegCapitalTypeExtract extends UDF {
|
|
|
|
+
|
|
|
|
+ public static final Pattern pattern = Pattern.compile("^[0-9\\.]+[百千万亿]{0,2}[元]?(.*)$");
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 功能描述:返回币种
|
|
|
|
+ *
|
|
|
|
+ * @param regCapital 注册资本 eg. 102.3万人民币
|
|
|
|
+ * @return: java.lang.String 人民币
|
|
|
|
+ * @auther: XuJiakai
|
|
|
|
+ * @date: 2020/5/19 11:58
|
|
|
|
+ */
|
|
|
|
+ public String evaluate(String regCapital) {
|
|
|
|
+ Matcher matcher = pattern.matcher(regCapital);
|
|
|
|
+ return matcher.replaceAll("$1");
|
|
|
|
+ }
|
|
|
|
+}
|