惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 站得更高,看得更远

使用ServletContextListener在服务器启动和关闭时创建和关闭缓存 Tomcat的class加载的优先顺序一览 tomcat 中解决打开xls文件的乱码问题 鼠标在图片上滚动放大或者缩小图片的代码 - 站得更高,看得更远 - 博客园 弹出窗口居中 - 站得更高,看得更远 弹出窗口大全(js) - 站得更高,看得更远 网页常用小技巧(JavaScript) - 站得更高,看得更远 - 博客园 Javascript 小技巧集 LookupDispatchAction, MappingDispatchAction深入分析 Strus 2的新表单标志的使用 Struts 2与AJAX(第二部分) Struts 2与AJAX(第一部分) Struts 2中的OGNL 常用的Struts 2.0的标志(Tag)介绍 在Struts 2.0中国际化(i18n)您的应用程序 在Struts 2.0中实现表单数据校验(Validation) 在Struts 2中实现IoC - 站得更高,看得更远 在Struts 2中实现文件上传 转换器(Converter)——Struts 2.0中的魔术师 - 站得更高,看得更远
汉字转拼音缩写 - 站得更高,看得更远 - 博客园
站得更高,看得更远 · 2009-03-21 · via 博客园 - 站得更高,看得更远

/**
  * 汉字转拼音缩写
  *
  * @param str
  *            //要转换的汉字字符串
  * @return String //拼音缩写
  */
 public static String getPYString(String str) {
  String tempStr = "";
  for (int i = 0; i < str.length(); i++) {
   char c = str.charAt(i);
   if ((int) c >= 33 && (int) c <= 126) {// 字母和符号原样保留
    tempStr += String.valueOf(c);
   } else {// 累加拼音声母
    tempStr += getPYChar(String.valueOf(c));
   }
  }
  return tempStr;
 }

 /**
  * 取单个字符的拼音声母
  *
  * @param c
  *            //要转换的单个汉字
  * @return String 拼音声母
  */
 public static String getPYChar(String c) {
  byte[] array = new byte[2];
  array = String.valueOf(c).getBytes();
  int i = (short) (array[0] - '\0' + 256) * 256
    + ((short) (array[1] - '\0' + 256));
  if (i < 0xB0A1)
   return "*";
  if (i < 0xB0C5)
   return "a";
  if (i < 0xB2C1)
   return "b";
  if (i < 0xB4EE)
   return "c";
  if (i < 0xB6EA)
   return "d";
  if (i < 0xB7A2)
   return "e";
  if (i < 0xB8C1)
   return "f";
  if (i < 0xB9FE)
   return "g";
  if (i < 0xBBF7)
   return "h";
  if (i < 0xBFA6)
   return "j";
  if (i < 0xC0AC)
   return "k";
  if (i < 0xC2E8)
   return "l";
  if (i < 0xC4C3)
   return "m";
  if (i < 0xC5B6)
   return "n";
  if (i < 0xC5BE)
   return "o";
  if (i < 0xC6DA)
   return "p";
  if (i < 0xC8BB)
   return "q";
  if (i < 0xC8F6)
   return "r";
  if (i < 0xCBFA)
   return "s";
  if (i < 0xCDDA)
   return "t";
  if (i < 0xCEF4)
   return "w";
  if (i < 0xD1B9)
   return "x";
  if (i < 0xD4D1)
   return "y";
  if (i < 0xD7FA)
   return "z";
  return "*";
 }