posts - 2,  comments - 2,  trackbacks - 0
            置頂隨筆
                昨天發(fā)現(xiàn)一號玩的jar包(pinyin4j-2.5.0.jar),可以把漢字轉(zhuǎn)為拼音。可在http://pinyin4j.sourceforge.net/下載。下面是我做的一個Demo

          import net.sourceforge.pinyin4j.PinyinHelper;
          import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
          import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
          import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
          import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
          import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
          public class HanZiToPinYin {


              
          public static  String toPinYin(String hanzhis){
                  CharSequence s
          = hanzhis;
                  
                  
          char [] hanzhi=new char[s.length()];
                  
          for(int i=0;i<s.length();i++){
                      hanzhi[i]
          =s.charAt(i);
                  }

                  
                  
          char [] t1 =hanzhi; 
                  String[] t2 
          = new String[s.length()];
                  
          /**
                   * 設(shè)置輸出格式
                   
          */

                  net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat t3 
          = new
                  HanyuPinyinOutputFormat();
                  t3.setCaseType(HanyuPinyinCaseType.UPPERCASE);
                  t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
                  t3.setVCharType(HanyuPinyinVCharType.WITH_V);
                  
                  
          int t0=t1.length;
                  String py 
          = "";
                  
          try {
                      
          for (int i=0;i<t0;i++)
                      
          {
                          t2 
          = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3);
                          py
          =py+t2[0].toString();
                              }

                  }

                  
          catch (BadHanyuPinyinOutputFormatCombination e1) {
                      e1.printStackTrace();
                  }

                  
                  
          return py.trim();
                  }

              
              
              
              
              
          public static void main(String[] args) {
                  
                  System.err.println(ToPinYin.toPinYing(
          "漢字轉(zhuǎn)拼音"));
              }

           
          }


          輸出結(jié)果:hanzizhuanpinyin
                  轉(zhuǎn)換的正確率,還不錯。
          詳細(xì)請查看官方文檔!
          posted @ 2008-11-20 09:56 R_XiaoGuang 閱讀(3035) | 評論 (2)編輯 收藏
               摘要:   閱讀全文
          posted @ 2008-09-20 07:31 R_XiaoGuang 閱讀(133) | 評論 (0)編輯 收藏
            2008年11月20日
                昨天發(fā)現(xiàn)一號玩的jar包(pinyin4j-2.5.0.jar),可以把漢字轉(zhuǎn)為拼音。可在http://pinyin4j.sourceforge.net/下載。下面是我做的一個Demo

          import net.sourceforge.pinyin4j.PinyinHelper;
          import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
          import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
          import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
          import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
          import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
          public class HanZiToPinYin {


              
          public static  String toPinYin(String hanzhis){
                  CharSequence s
          = hanzhis;
                  
                  
          char [] hanzhi=new char[s.length()];
                  
          for(int i=0;i<s.length();i++){
                      hanzhi[i]
          =s.charAt(i);
                  }

                  
                  
          char [] t1 =hanzhi; 
                  String[] t2 
          = new String[s.length()];
                  
          /**
                   * 設(shè)置輸出格式
                   
          */

                  net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat t3 
          = new
                  HanyuPinyinOutputFormat();
                  t3.setCaseType(HanyuPinyinCaseType.UPPERCASE);
                  t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
                  t3.setVCharType(HanyuPinyinVCharType.WITH_V);
                  
                  
          int t0=t1.length;
                  String py 
          = "";
                  
          try {
                      
          for (int i=0;i<t0;i++)
                      
          {
                          t2 
          = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3);
                          py
          =py+t2[0].toString();
                              }

                  }

                  
          catch (BadHanyuPinyinOutputFormatCombination e1) {
                      e1.printStackTrace();
                  }

                  
                  
          return py.trim();
                  }

              
              
              
              
              
          public static void main(String[] args) {
                  
                  System.err.println(ToPinYin.toPinYing(
          "漢字轉(zhuǎn)拼音"));
              }

           
          }


          輸出結(jié)果:hanzizhuanpinyin
                  轉(zhuǎn)換的正確率,還不錯。
          詳細(xì)請查看官方文檔!
          posted @ 2008-11-20 09:56 R_XiaoGuang 閱讀(3035) | 評論 (2)編輯 收藏
            2008年9月20日
               摘要:   閱讀全文
          posted @ 2008-09-20 07:31 R_XiaoGuang 閱讀(133) | 評論 (0)編輯 收藏
            2008年7月5日
          此源碼來自http://hi.baidu.com/imake/blog/item/4364a51eb0af1d1a40341715.html


          我直接發(fā)源代碼了,大家自己編譯,然后運(yùn)行就可以了。

          //Myeclipse Blue6 .5 破解程序

          import java.text.DecimalFormat; 
          import java.text.NumberFormat; 
          import java.text.SimpleDateFormat; 
          import java.util.Calendar; 

          public class Crack { 
              
          public static final void main(String[] args){ 
                  String id
          ="iMake";//這里填你想注冊的名字
                  String num="3";//這里填你想注冊的使用年限,最大為999
                  System.out.println(getSerial(id,"100",num,false)); 
              } 
              
          public static String getSerial(String userId, String version, 
                      String licenseNum, 
          boolean selected) { 
                  Calendar cal 
          = Calendar.getInstance(); 
                  cal.add(
          13); 
                  cal.add(
          6-1); 
                  NumberFormat nf 
          = new DecimalFormat("000"); 
                  licenseNum 
          = nf.format(Integer.valueOf(licenseNum)); 
                  String verTime 
          = selected ? (new StringBuffer("-")).append( 
                          (
          new SimpleDateFormat("yyMMdd")).format(cal.getTime())).append( 
                          
          "0").toString() : "-0812310"
                  String type 
          = "YE3MB-"
                  String need 
          = (new StringBuffer(String.valueOf(userId.substring(01)))) 
                          .append(type).append(version).append(licenseNum) 
                          .append(verTime).toString(); 
                  String dx 
          = (new StringBuffer(String.valueOf(need))) 
                          .append( 
                                  
          "Decompiling this copyrighted software is a violation of both your

          license agreement and the Digital Millenium Copyright Act of 
          1998

          (http:
          //www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA,

          penalties range up to a $
          500,000 fine or up to five years imprisonment for a first offense.

          Think about it; pay 
          for a license, avoid prosecution, and feel better about yourself."
                           
                                  .append(userId).toString(); 
                  
          int suf = decode(dx); 
                  String code 
          = (new StringBuffer(String.valueOf(need))).append( 
                          String.valueOf(suf)).toString(); 
                  
          return change(code); 
              } 

              
          private static int decode(String s) { 
                  
          int i = 0
                  
          char ac[] = s.toCharArray(); 
                  
          int j = 0
                  
          for (int k = ac.length; j < k; j++
                      i 
          = 31 * i + ac[j]; 

                  
          return Math.abs(i); 
              } 

              
          private static String change(String s) { 
                  
          byte abyte0[] = s.getBytes(); 
                  
          char ac[] = new char[s.length()]; 
                  
          int i = 0
                  
          for (int k = abyte0.length; i < k; i++) { 
                      
          int j = abyte0[i]; 
                      
          if (j >= 48 && j <= 57
                          j 
          = ((j - 48+ 5% 10 + 48
                      
          else if (j >= 65 && j <= 90
                          j 
          = ((j - 65+ 13% 26 + 65
                      
          else if (j >= 97 && j <= 122
                          j 
          = ((j - 97+ 13% 26 + 97
                      ac[i] 
          = (char) j; 
                  } 

                  
          return String.valueOf(ac); 
              } 
          }



          posted @ 2008-07-05 17:15 R_XiaoGuang 閱讀(2990) | 評論 (0)編輯 收藏
          僅列出標(biāo)題  
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          沒有什么不可以承受,只是沒有落到自己身上。

          沒有什么不可以成功,只是沒有真正的努力過。

           

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          最新隨筆

          搜索

          •  

          積分與排名

          • 積分 - 7313
          • 排名 - 2724

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 镇平县| 田林县| 金平| 马鞍山市| 大兴区| 磴口县| 盐池县| 岑溪市| 遂平县| 抚松县| 枞阳县| 汝州市| 陈巴尔虎旗| 安平县| 凤台县| 马鞍山市| 平度市| 甘孜县| 白城市| 抚顺市| 崇明县| 抚松县| 万荣县| 凉山| 郁南县| 石台县| 正安县| 河北省| 老河口市| 长白| 齐河县| 米林县| 三明市| 高要市| 牡丹江市| 应城市| 泸州市| 炉霍县| 门头沟区| 无为县| 邳州市|