swanwish / blog

My blog website
0 stars 0 forks source link

过滤占用四字节以上的utf8字符 #28

Open swanwish opened 7 years ago

swanwish commented 7 years ago
    public static String filterOffUtf8Mb4(String content) {
        if (content == null) {
            return null;
        }
        return content.replaceAll("[\\ud800\\udc00-\\udbff\\udfff\\ud800-\\udfff]", "");
    }