现在用的最笨的拼接空格的方法,导致格式混乱
private static void getSpace(StringBuffer sb,String str,int len){
int countCn = 0; //中文的个数
for(int i = 0 ;i<str.length();i++){
if(ifCN(str.charAt(i))){
countCn ++ ;
}
}
if(countCn!=0){
if(countCn/2 == 0){
countCn = (countCn/2 * 3) -1;
}else{
countCn = (countCn/2 * 3) +1;
}
}
int spacelen = len - str.length()*2 - countCn ;
sb.append(str);
for(int i = 1 ;i<=spacelen ;i++){
sb.append(" ");
}
}
希望能对齐,或者最好以表格形式整理https://img-mid.csdnimg.cn/release/static/image/mid/ask/286749970046168.png "#left")
用富文本域,通过前端标签控制样式。