Commit 94c96b76 authored by yanzg's avatar yanzg

Excel导出功能

parent 8a38ac24
......@@ -11,6 +11,8 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 字符串帮主类
......@@ -941,4 +943,27 @@ public class StringHelper {
}
return from.replaceAll("-", "");
}
/**
* 获取字段替换值
*
* @param from 来源字符串
* @param target  值对象
* @return 处理后的值对象
*/
public static String getCodeString(String from, Object target) {
String regex = "\\{.*?\\}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(from);
// 寻找到的代码片段 不包含分括号
while (m.find()) {
String name = m.group();
String value = StringHelper.getFirst(ObjectHelper.getString(target, name), EMPTY);
from = from.replace(name, value);
}
return from;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment