Files.write(Paths.get("path.txt"), stringBuilder.toString().getBytes(StandardCharsets.UTF_8));
String s1 = value.replaceAll("[^-/'\\p{Alpha}]", " ").replace("2020", "")
                .replace("2021", "");

        StringBuilder stringBuilder = new StringBuilder();

        for (String s2 : s1.split(ONE_SPACE_STR)) {

            String s3 = s2.trim();

            if (StringUtils.isNotBlank(s3)) {

                stringBuilder.append(s3).append(" ");

            }

        }
        return stringBuilder.toString().trim();
String s1 = value.replaceAll("\\P{Alnum}", " ");

        StringBuilder stringBuilder = new StringBuilder();

        for (String s2 : s1.split(ONE_SPACE_STR)) {

            String s3 = s2.trim();

            if (StringUtils.isNotBlank(s3)) {

                stringBuilder.append(CharSequenceUtil.upperFirst(s3)).append(" ");

            }

        }
        return stringBuilder.toString().trim();


正则

[a-zA-Z'\\s]+$
[^-/'\\p{Alpha}]
/^(([1-9]{1}\d*)|(0{1}))(\.\d{0,2})$/、/^(([1-9]{1}\d*)|(0{1}))$/

包含表情符的字符串长度判断

private int countStrCodeIndexCount(String s){
        int count = 0;
        if (StringUtils.isNotBlank(s) && s.trim().length() > 0) {

            for (;;){
                try {
                    if (count == 0) {
                        s.offsetByCodePoints(count, 1);
                    }else {
                        s.offsetByCodePoints(0, count);
                    }
                    count++;
                } catch (Exception e) {
                    return count-1;
                }
            }
        }
        return count;
    }

这个好一点吧:

"😊😊".codePoints().count() 
@JsonIgnoreProperties(ignoreUnknown = true)

Mybatis 转义

原符号 < <= > >= & ' " 

替换符号 &lt; &lt;= &gt; &gt;= &amp; &apos; &quot;

大于等于 <![CDATA[ >= ]]> 
小于等于 <![CDATA[ <= ]]>