/**
  * 将十进制形式的Unicode编码转换为字符,例如   36215->北 (起)
  * @param codePoints
  * @return
  */
 public static String fromCharCode(int... codePoints) {
  
  StringBuilder builder = new StringBuilder(codePoints.length); 
  for (int codePoint : codePoints){      
   builder.append(Character.toChars(codePoint));  
   }   
         return builder.toString();
   }
 
 /**
  * 将起飞 转化为 只含有整数值的数组   result[0]=36215,result[1]=39134
  * @param unicodeStr
  * @return
  */
 public static int[] removeUnicodeFlag(String unicodeStr){
  String regex = "&#(\\d+);";
  int result[]  = new int[unicodeStr.split(";").length];
  Pattern p = Pattern.compile(regex);
  Matcher ma = p.matcher(unicodeStr);
  int i = 0;
  while (ma.find()) {
   result[i++] = Integer.parseInt(ma.group(1));
  }
  return result;
 }
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
相关资源
相似解决方案