java替换字符串中某个符号

    技术2022-07-31  70

    package test;

    public class 替换手机号里面的加号 {

        public static void main(String[] args) {         String str="+565612332";         String s="";         if(str.contains("+")) {           s=str.replace("+","A");         }         // A565612332         //System.out.println(s);                  String str1=unicodeToString("\u0002");         System.out.println(str1+"----");                  

        }          public static String unicodeToString(String unicode) {             StringBuffer sb = new StringBuffer();             String[] hex = unicode.split("\\\\u");                 for (int i = 1; i < hex.length; i++) {                     int index = Integer.parseInt(hex[i], 16);                 sb.append((char) index);                 }             return sb.toString();         }     

    }  

    Processed: 0.024, SQL: 9