C#-汉字转拼音缩写
/// 〈summary〉
/// 汉字转拼音缩写
/// Code By MuseStudio@hotmail.com
/// 2004-11-30
/// 〈/summary〉
/// 〈param name="str"〉要转换的汉字字符串〈/param〉
/// 〈returns〉拼音缩写〈/returns〉
public string GetPYString(string str)
{
string tempStr = "";
foreach(char c in str)
{
if((int)c 〉= && (int)c 〈=)
{//字母和符号原样保留
tempStr += c.ToString();;
}
else
{//累加拼音声母
tempStr += GetPYChar(c.ToString());;
}
}
return tempStr;;
} /// 〈summary〉
/// /// Code By MuseStudio@hotmail.com
/// 2004-11-30
/// 〈/summary〉
/// 〈param name="c"〉要转换的单个汉字〈/param〉
/// 〈returns〉拼音声母〈/returns〉
public string GetPYChar(string c)
{
byte[] array = new byte[];
array = System.Text.Encoding.Default.GetBytes(c);
int i = (short)(array[] - '\0') * + ((short)(array[] - '\0'));
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 "g";
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 "*";;
}
C#-汉字转拼音缩写的更多相关文章
- C# 获取汉字转拼音缩写-简写,不是全拼
///<summary> /// 汉字转拼音缩写 /// Code By ] -'\0')); if ( i <0xB0A1) return"*" ...
- C#实现汉字转换为拼音缩写的代码
using System; using System.Configuration; using System.Data; using System.Web; using System.Web.Secu ...
- C#汉字转拼音帮助类
using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressi ...
- C#汉字转拼音首字母
输入汉字,提取其首字母: /// <summary> /// 汉字转拼音缩写 /// Code By /// 2004-11-30 /// </summary> /// < ...
- java字符操作获取汉字的拼音以及其它经常使用工具
公司需求年年有,今年有点小特殊,哈哈. 忽然加了个需求,说要实现汉字转拼音查询. 在努力下写出来了,如今分享一下吧!.! /** * 汉字转拼音缩写 * * @param str * 要转换的汉字字符 ...
- 汉字转拼音首字母的java实现
工作中经常会遇到的一些排序问题,比如 按汉字的拼音首字母排序,比如人名排序等,就要用到下面的方法了,思路: 1. 获得汉字 2. 将汉字转换成首字母,并记录下(必要时保存到数据库) 3. 按首字母进行 ...
- 文件一键上传、汉字转拼音、excel文件上传下载功能模块的实现
----------------------------------------------------------------------------------------------[版权申明: ...
- java汉字转拼音的工具类
import com.google.common.base.Strings;import net.sourceforge.pinyin4j.PinyinHelper;import net.source ...
- php方法-------将汉字转为拼音或者提取汉字首字母
将汉字转为全拼,提取汉字首字母 <?php /** * 基于PHP语言的汉语转拼音的类 * 兼容 UTF8.GBK.GB2312 编码,无须特殊处理 * 对中文默认返回拼音首字母缩写,其它字符不 ...
随机推荐
- 宿主机mac os无法连接到虚拟机centos
宿主机: Mac OS 10.9.2 虚拟机: [root@localhost ~]# cat /etc/redhat-release CentOS release 6.4 (Final) [root ...
- Linux下处理JSON的命令行工具:jq---安装
转自:https://blog.csdn.net/Sunny_much/article/details/50668871 JSON是前端编程经常用到的格式.Linux下也有处理处理JSON的 ...
- [hihocoder #1384] Genius ACM 解题报告(倍增)
题目链接:http://hihocoder.com/problemset/problem/1384 题目大意: 给定一个整数 M,对于任意一个整数集合 S,定义“校验值”如下: 从集合 S 中取出 M ...
- [Swift]数组(Array)最强解析
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- node,koa 图片批量添加水印,可手动配置水印位置
公司设计在处理京东上架商品图片的时候,需要给设计好的图片添加京东的“logo”,并且logo位置得根据图片来摆放,需要通过计算得出logo位置.那样太麻烦了,于是就用node,koa写了批量给图片添加 ...
- 改变GridView中列的宽度
<asp:TemplateField HeaderText="规格型号" HeaderStyle-Width="24%">
- layui中选中select标签 隐藏div
在select标签中添加 lay-filter="cartype" <script type="text/javascript"> form.on( ...
- 优动漫PAINT-樱花教程
很雅致清新的樱花教程~在很多地方都可以运用到哟~原文转载自优动漫官网. 想要Get到更多有关优动漫的信息包括软件下载,可关注http://www.dongmansoft.com.
- DIV+CSS布局中自适应高度的解决方法
div乱跑问题 (文件<DIV+CSS布局中自适应高度的解决方法.rar>) float 是个很危险的东西 得小心使用 本来有一很好的关于CSS+DIV的论坛 不过现在关门了 甚是可 ...
- HDFS架构与原理
HDFS HDFS 全称hadoop分布式文件系统,其最主要的作用是作为 Hadoop 生态中各系统的存储服务 特点 优点 • 高容错.高可用.高扩展 -数据冗余多副本,副本丢失后自动恢复 -Name ...