首页 > 代码库 > 代码实现native2assci

代码实现native2assci

 1 public static void main(String[] args) { 2         String unicode = ""; 3         String s="用户名"; 4         char[] charAry = new char[s.length()]; 5         for(int i=0; i<charAry.length; i++) { 6           charAry[i] = (char)s.charAt(i); 7            unicode+="\\u" + Integer.toString(charAry[i], 16); 8         } 9         System.out.println(unicode);10     }

 

代码实现native2assci