风之语

posts(201) comments(182) trackbacks(1)
  • BlogJava
  • 联系
  • RSS 2.0 Feed 聚合
  • 管理

常用链接

  • 我的随笔
  • 我的评论
  • 我的参与
  • 最新评论

留言簿

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔分类

  • ajax(1)
  • android(1)
  • apache(1)
  • AppFuse(1)
  • BIRT(1)
  • iText(1)
  • JSF(8)
  • kettle(1)
  • linux(5)
  • mac(1)
  • maven(1)
  • MSTR(3)
  • Open XML(1)
  • Oracle(21)
  • RCP
  • Struts(2)
  • Struts2(2)
  • SybaseIQ(6)
  • tapestry
  • tomcat(2)
  • weblogic(1)
  • webservice(1)
  • weka(1)
  • 云计算(1)
  • 收藏(31)
  • 数据仓库(11)
  • 架构设计(3)
  • 生活(2)
  • 集群(1)
  • 项目管理(6)

随笔档案

  • 2012年12月 (4)
  • 2012年11月 (1)
  • 2012年7月 (2)
  • 2011年8月 (1)
  • 2011年7月 (1)
  • 2011年3月 (1)
  • 2010年12月 (2)
  • 2010年11月 (4)
  • 2010年10月 (3)
  • 2010年9月 (5)
  • 2010年8月 (1)
  • 2010年7月 (4)
  • 2010年3月 (1)
  • 2010年2月 (3)
  • 2009年12月 (3)
  • 2009年11月 (4)
  • 2009年9月 (3)
  • 2009年6月 (5)
  • 2009年5月 (3)
  • 2009年4月 (2)
  • 2009年3月 (5)
  • 2009年2月 (4)
  • 2009年1月 (2)
  • 2008年11月 (2)
  • 2008年9月 (1)
  • 2008年7月 (2)
  • 2008年6月 (4)
  • 2008年5月 (6)
  • 2008年4月 (1)
  • 2008年3月 (1)
  • 2007年12月 (2)
  • 2007年11月 (5)
  • 2007年10月 (2)
  • 2007年9月 (3)
  • 2007年8月 (3)
  • 2007年4月 (1)
  • 2007年3月 (2)
  • 2007年2月 (2)
  • 2007年1月 (2)
  • 2006年12月 (3)
  • 2006年8月 (2)
  • 2006年7月 (2)
  • 2006年6月 (2)
  • 2006年4月 (2)
  • 2006年3月 (1)
  • 2006年2月 (3)
  • 2006年1月 (6)
  • 2005年12月 (6)
  • 2005年11月 (4)
  • 2005年10月 (17)
  • 2005年9月 (25)
  • 2005年8月 (16)
  • 2005年7月 (8)

相册

  • 技术图片

收藏夹

  • java

link

My wife

  • My wife's blog

最新随笔

  • 1. apache修改最大连接并用ab网站压力测试
  • 2. Vm虚拟机访问本地硬盘文件
  • 3. NFS文件无法写入的权限问题
  • 4. weblogic设置上传文件访问权限
  • 5. 在android上动态实现ichartjs的3D柱形图
  • 6. 使用Oracle trunc 来指定精确的年月日时分秒
  • 7. Quartz 2.1.5 web应用配置
  • 8. LoginAny 使用笔记
  • 9. MyEclipse 无响应的几种解决办法
  • 10. java.sql.SQLException: No more data to read from socket

搜索

  •  

积分与排名

  • 积分 - 402279
  • 排名 - 139

最新评论

  • 1. re: 使用Oracle trunc 来指定精确的年月日时分秒[未登录]
  • 政治
  • --张三
  • 2. re: 干掉流氓软件vrvrf_c.exe,vrvedp_m.exe[未登录]
  • `
  • --1
  • 3. re: 无需刻录DMG光盘,教你在VMWare下安装MAC OS X Snow Leopard 10.6
  • 我走到了换DMG映像的时候,然后就没有反应了,这个是什么情况,是不是我的映像文件有问题,还是。。。。
  • --玉竹常青
  • 4. re: LoginAny 使用笔记
  • 怎么没一个人留言,现在来是不是在挖坟啊
  • --ellipse
  • 5. MSTR web应用的部署[未登录]
  • 请问,如何用oracle Application Server服务器部署mstr web应用?
  • --rocky

阅读排行榜

评论排行榜

View Post

获得汉字拼音首字母的java工具类【转载】


public class GetCh2Spell
        {
            public static int compare(String str1, String str2)
             {
                 int result = 0;
                 String m_s1 = null;
                 String m_s2 = null;
                 try
                 {
                     m_s1 = new String(str1.getBytes(_FromEncode_), _ToEncode_);
                     m_s2 = new String(str2.getBytes(_FromEncode_), _ToEncode_);
                 }
                 catch(Exception e)
                 {
                     return str1.compareTo(str2);
                 }
                 result = chineseCompareTo(m_s1, m_s2);
                 return result;
             }

             public static int getCharCode(String s)
             {
                 if(s == null && s.equals(""))
                     return -1;
                 byte b[] = s.getBytes();
                 int value = 0;
                 for(int i = 0; i < b.length && i <= 2; i++)
                     value = value * 100 + b[i];

                 return value;
             }

             public static int chineseCompareTo(String s1, String s2)
             {
                 int len1 = s1.length();
                 int len2 = s2.length();
                 int n = Math.min(len1, len2);
                 for(int i = 0; i < n; i++)
                 {
                     int s1_code = getCharCode(s1.charAt(i) + "");
                     int s2_code = getCharCode(s2.charAt(i) + "");
                     if(s1_code * s2_code < 0)
                         return Math.min(s1_code, s2_code);
                     if(s1_code != s2_code)
                         return s1_code - s2_code;
                 }

                 return len1 - len2;
             }

             public static String getBeginCharacter(String res)
             {
                 String a = res;
                 String result = "";
                 for(int i = 0; i < a.length(); i++)
                 {
                     String current = a.substring(i, i + 1);
                     if(compare(current, "\u554A") < 0)
                         result = result + current;
                     else
                     if(compare(current, "\u554A") >= 0 && compare(current, "\u5EA7") <= 0)
                         if(compare(current, "\u531D") >= 0)
                             result = result + "z";
                         else
                         if(compare(current, "\u538B") >= 0)
                             result = result + "y";
                         else
                         if(compare(current, "\u6614") >= 0)
                             result = result + "x";
                         else
                         if(compare(current, "\u6316") >= 0)
                             result = result + "w";
                         else
                         if(compare(current, "\u584C") >= 0)
                             result = result + "t";
                         else
                         if(compare(current, "\u6492") >= 0)
                             result = result + "s";
                         else
                         if(compare(current, "\u7136") >= 0)
                             result = result + "r";
                         else
                         if(compare(current, "\u671F") >= 0)
                             result = result + "q";
                         else
                         if(compare(current, "\u556A") >= 0)
                             result = result + "p";
                         else
                         if(compare(current, "\u54E6") >= 0)
                             result = result + "o";
                         else
                         if(compare(current, "\u62FF") >= 0)
                             result = result + "n";
                         else
                         if(compare(current, "\u5988") >= 0)
                             result = result + "m";
                         else
                         if(compare(current, "\u5783") >= 0)
                             result = result + "l";
                         else
                         if(compare(current, "\u5580") >= 0)
                             result = result + "k";
                         else
                         if(compare(current, "\u51FB") > 0)
                             result = result + "j";
                         else
                         if(compare(current, "\u54C8") >= 0)
                             result = result + "h";
                         else
                         if(compare(current, "\u5676") >= 0)
                             result = result + "g";
                         else
                         if(compare(current, "\u53D1") >= 0)
                             result = result + "f";
                         else
                         if(compare(current, "\u86FE") >= 0)
                             result = result + "e";
                         else
                         if(compare(current, "\u642D") >= 0)
                             result = result + "d";
                         else
                         if(compare(current, "\u64E6") >= 0)
                             result = result + "c";
                         else
                         if(compare(current, "\u82AD") >= 0)
                             result = result + "b";
                         else
                         if(compare(current, "\u554A") >= 0)
                             result = result + "a";
                 }

                 return result;
             }

             public static String getFirstStr(String str)
             {
                 char a = str.charAt(0);
                 char aa[] = {
                     a
                 };
                 String sss = new String(aa);
                 if(Character.isDigit(aa[0]))
                     sss = "data";
                 else
                 if(a >= 'a' && a <= 'z' || a >= 'A' && a <= 'Z')
                     sss = "character";
                 else
                     sss = getBeginCharacter(sss);
                 return sss;
             }

             private static String _FromEncode_ = "GBK";
             private static String _ToEncode_ = "GBK";

        }

posted on 2006-12-05 18:35 风 阅读(816) 评论(0)  编辑  收藏 所属分类: 收藏

新用户注册  刷新评论列表  

只有注册用户登录后才能发表评论。


网站导航:
博客园   IT新闻   Chat2DB   C++博客   博问   管理
相关文章:
  • LoginAny 使用笔记
  • 资源管理器搜索包含文字的文件找不到的解决方法
  • xp下删除windows7,无法删除windows7文件夹,无法删除windows7文件,双系统卸载,取得文件权限
  • 利用windows系统ftp命令编写的BAT文件上传[转]
  • jxl操作excel例子(转)
  • I18N-国际化消息和日志
  • 使用 AppFuse 的七个理由
  • Office (2007) Open XML 文件格式简介
  • [转]Reporting Services与相关产品的比较
  • 自定义file类型input框样式的方法
 
 
Powered by:
BlogJava
Copyright © 风