java去除样式html

package com.zjazn.utils;

public class ShowChineseUtil {
public static String getShowCharacter(String oriText, Integer length, String afterStr) {
String afterContent = oriText.replaceAll("[^\u4E00-\u9FA5|,|。|?|!|、]", "");
if (afterContent.length()>length){
afterContent=afterContent.substring(0,length)+afterStr;
}
return afterContent;
}

public static void main(String[] args) {
System.out.println(getShowCharacter("11212你好jifsdf",20,""));
}
}
posted @ 2021-01-12 12:33  小庄的blog  阅读(207)  评论(0编辑  收藏  举报