javaʵֵĺתʹʵ

 ʱ䣺20170629 10:17:21   ߣjackerx  
ƪҪjavaʵֵĺתʹ,ϾʵʽjavaַתȲʵʱȡز,ҪѿԲο

ʵjavaʵֵĺתʹܡҹҲο£

package com.core.utils;
/**
 * ת
 * @author Jacker
 * @date 2010-12-12
 */
public class CnToWB {
  private static String[] WB = new String[] {
      "A߰߯߮޿޾޽޼޻޺޹޸޷޶޵޴޳޲ޱްޯޮޭެޫުީިާަޥޤޣޢޡݿݾݽݼݻݺݹݸݷݶݵݴݳݲݱݰݯݮݭݬݫݪݩݨݧݦݥݤݣݢݡܾܼܻܹܸܷܴܿܽܺܶܵܳ۴۱إ֥պԷӫӪөӨӢҽҩҢѿѻѦѥонаЬϻεήέ̦˹ʽɻɯɢȵȧֿ޾վϾڽԼǾƼƻƥźŹŸŷĽļĻĺĹijĪĢġïéçãâ«ƻĻʺɺʷҷ˷ƷٵдijݲزԲ̲˲ޱαͱаŰ",
      "B۸ؽة׹ְԺҲҮѷ϶Ȣȡ׾۽׽Ƹݽª¤¡꺯¹Ӷϳܳг±ݰ",
      "CۢפԦԥԤѱϷ̨ͨ˫ʻʥɧɣȰݿԾ輦ƭIJì¿۶Ե˵۳Ҳβ",
      "D۽ۺשԸԭӲҳѹϮ̼̬̫̩˶ˬˣʯʢɰȷȮڿ˿ĿǾ¾ۻһǣµ¢׺ĺ˹ʹŹзܷǷŴɳ޲ñٰҰ",
      "Eۮؾ֬֫ӷӯҸҨңвϥ̥˴˦ʤŽǻƢŧĤòѹɸظθηʷǵ೦ʲɲ򰹰",
      "Fܱܲܰܯܮܭܬܫܪܩܨܧܦܥܤܣܢܡ۹أءר־ֱַ֧ԽԶԬԫԪҼѩЭТϼϲδΥΤ̹̳̮˪ʿʾʮɥȴȥȤӿǿȾٽؽ̼μǽǬƺù¶ػպºĹϸɸطնѶ¶ߵص̴紣dzóŲò԰Ӱ",
      "G۳۪ۣۤجثتبائؤ׸ֳյһѳʴɺɪ߼ռмƽŪĩõһ񷩶ٶ嵽̲ܲвϲ̱Ʊ°߰",
      "Hح׿ֹսռհգѣЩϹ͹ͫ˲˯ȣϿ߾ɾƵƤŰĿ²±­¬仢öɴ˴ƳݲͲDz",
      "Iػע֭տմԴԨԡӿӾҺҫѴѧкйФСϴϫϪμΫͿ̶̲̭͡ˮʪʡɳɬȾȸʿھپƽཽüdzDZǢƯŽŨŢĮĭûº©ӻԺӺƺ۸ȸڷзɶӵε㴾سγײ",
      "Jخ֩ԻӼӳӰӬҷҰЫЪϾϺ˧ʱʦɹž޻׻λůðٺ纵Ƹ絩׳",
      "K߿߾߽߼߻ߺ߹߸߷߶ߵߴֺֻ߲߳۫֨զԾԱӽӻӴҶҭҧѽѫХιζΨ̤̣̾˻˳˱ʷɶɤ޿ڿԿпȿ׽нǺDzƷơſžŻŶ·ߺٺȺǺźй¸Էͷȶ߶׶ֶŵڴԳѳʳȲɱİϰɰȰ",
      "LתշնԲ԰ԯѼϽθηΧͼ˼ȦϽμݼܼ׼ӼǵǭĬīԺںع̸ڳ복߰",
      "M׬֡ոӤϿΡͮͬ̿ɾɽȽ߻ϻǶñ¸뺡ǹڸոԸ巷ĵϵ޴ʹƱܰ",
      "NؿչѸмиϰϬϧοξβΩ˾ˢʺʭʬ쿶־Ӿɼ¼ڻֻлǡƩƨųüæ¾Ż޺߹ָҸķ߷ɷ趲Ե߳ٳҲѲܱ۱ڱٱذ",
      "O۰ճըҵϩϨ˸ɿȼȲÿ澼Ŵú¯¦溸۷ϵƴִ㳴ڲӱ",
      "P۩ڤڣڢף֮կխլԩԣԢҾҤѨдͻ̻ʵȹο߿ܿտ;ѼҼżĻũį»º׺ֺڹٹӹѹܴIJ첹",
      "Q߱۾ۼۻۭۨۧۡصسآ׶ղաԿԹԳԧӭӡҿѮпзϳϦϣΣ̡ͭʨɷɲɱɫȻѾľþȽǽƽ½ؼǷǯǮǦǥťþóîíêè³ԻݹݹָƸ淹۶ͶƶҵҴ²",
      "R߭߬߫ߪߩߨߧߦߥߤߣߢߡۯۥش׾׽ײ׫קצץִָֿժԮӵҴҡѺжЯЮͶͱ̧̢̯ͦ̽˺˩ˤʰʧɨɦȱȪۿٿؿݾܾоݽӽҽ𼼼ӻǤƹƴƲŲŤţšĴĨ°§£໻󺴺޹չҹϹ޸׸շ޶ݶֵܶĵݴֳųٲ챰ݰڰװѰΰǰư",
      "S۲׵׮ֲ֦ջեդӣҬҪеШУϭΦͰ̴̪ͪͩ˨ɼɭȶȩȨݿɿÿ¿ܽ۽ͽּϼǹƱưƮľģø÷ö´¥ֻ˺׹̸ܸ˸ŸٷӷŶ״ȳ۲ı걾",
      "T۶۬غعطضزرد׭֪ձէѭѬѪѡЦϵϤϢϡκί΢ͽͺ͸Ͳ̺ͧ͢˽˰ʸʣɸƿؾֽ̾սýڼջǩǨǧƬƪĵÿôë¨ܺͺ̺ܹԹιݸѸ͸귱̶ڵѵеȵõµ۴شѴǴӳͳ̳˳Ƴ߲ղұ˱ʱDZްʰ°",
      "U۷۵ڡ׼״׳ױװ֣֢վբӸұѾѢЧͷʹ̵̱ͯ˷ȳȯȭȬҾξ߽伽ǼǸǰƿƳƦƣűݻۺҹظӸǷ跧Ҷ˶ݵܵ۵մδɴȴôղױֱձԱṵ̋",
      "VۿظҦѲѰϱˡʼɩȺѿҿѿ˾ʾŽ˽޼˼ȼŮŭŬūķý¼ùøʵյ",
      "Wۦٿپٽټٻٺٹٸٷٶٵٴٳٲٱٰٯٮ٭٬٫٪٩٨٧٦٥٤٣٢١׷סֵֶծӶүбλαΰ;͵̰ͣʹʳʲɵɮɡȫп뿡ĽۼټѼǪƾƶƫƧżڻкϺκȹ븸޷ݷַ·ζ͵ʵǵߴٴԴӴ޳ֲ㱶۰ְ˰",
      "Xذ׺ּֽ֯ԼԵӱӧѤϸγάͳ˿ɴ¾Խʽɽͼ̼ǿŦĸƻûṭٸ׷ѷĶе޵´ڲѱбϱȱ",
      "Yڿھڽڼڻںڹڸڷڶڵڴڳڲڱڰگڮڭڬګڪکڨڧڦڥؼ׻ׯ֤իթӺӹӮӦӥҹҥѶѵѯлгϯνΪ̸̷ͥͤ˵˭˥ʶʫʩȿο̿;뽲ǼƼǴǫŵĶıħĦĥåäá¹®߻͸߸øϷ̷ŷ÷ضȶ׵ʴϲӰ",
      "@#%&*'~={}','|"};
  public static String getWBCode(String str) {
    StringBuffer result = new StringBuffer();
    //charѭȡÿһString ַ
    for (int i = 0; i < str.length(); i++) {
      char temp1 = str.charAt(i);
      int asciicode = (int)temp1;
      //254ڵASCII ʾĸֱַʾ跭
      if (asciicode >= 1 && asciicode <= 254) {
        result.append(temp1);
      }else{
        //ѭʵֿ⣨ַַ飩
        for (int j = 0; j < WB.length; j++) {
          char[] dbTmp = WB[j].toCharArray();
          //ѭÿӢĸֿ
          for (int k=1; k < dbTmp.length; k++) {
            //ҵ
            if((int)temp1==(int)dbTmp[k]){
              //WBһУıţֱʾʾӦĸ(еĵ1ַ)
              if(j==WB.length-1){
                result.append(dbTmp[k]);
              }else {
                result.append(dbTmp[0]);
              }
              break;
            }
          }
        }
      }
    }
    return result.toString();
  }
  public static void main(String[] args) {
    String str = "޹˾";//
    System.out.println(getWBCode(str));
    int total =0;
    for (String string : WB) {
      total+=string.length()-1;
    }
    System.out.println(":"+total);
  }
}

PSΪƼһ߹߹Ҳοʹã


http://tools.jb51.net/transcoding/wubi

java㷨ݸȤĶ߿ɲ鿴վר⣺JavaַַܽJavaܽJavaѧ㼼ܽJavaܽ͡Javaݽṹ㷨̳

ϣԴjava