C#获得汉字的首拼音
来源:互联网 发布:逆袭网络剧1第一视频 编辑:程序博客网 时间:2024/05/17 06:21
//多个汉字首字母
static public string GetChineseSpell(string strText)
{
int len = strText.Length;
string myStr = "";
for (int i = 0; i < len; i++)
{
myStr += getSpell(strText.Substring(i, 1));
}
return myStr;
}
//首个汉字首字母
static public string getSpell(string cnChar)
{
byte[] arrCN = Encoding.Default.GetBytes(cnChar);
if (arrCN.Length > 1)
{
int area = (short)arrCN[0];
int pos = (short)arrCN[1];
int code = (area << 8) + pos;
int[] areacode = {45217,45253,45761,46318,46826,47010,
47297,47614,48119,48119,49062,49324,49896,50371,
50614,50622,50906,51387,51446,52218,52698,52698,
52698,52980,53689,54481};
for (int i = 0; i < 26; i++)
{
int max = 55290;
if (i != 25) max = areacode[i + 1];
if (areacode[i] <= code && code < max)
{
return Encoding.Default.GetString(
new byte[] { (byte)(65 + i) });
}
}
return "*";
}
else return cnChar;
}
//测试
private void button1_Click(object sender, EventArgs e)
{
textBox2.Text = GetChineseSpell(textBox1.Text);
textBox3.Text = getSpell(textBox1.Text);
}
- C#获得汉字的首拼音
- C#获得汉字的首拼音
- 输入汉字获得拼音(C#)
- 获得汉字的拼音首字母
- 获得汉字拼音的首字母
- 根据汉字获得它的拼音
- 获得汉字字符串拼音简码的方法
- 获得汉字拼音首位字母的函数
- 如何获得汉字拼音的首字母序列
- 获得汉字拼音首字母的工具类
- 获得汉字拼音首字母
- 获得汉字拼音缩写
- 根据汉字获得拼音
- 获得汉字拼音首字母
- 获得汉字拼音首字母
- 获得汉字拼音首字母
- C#,获得汉字的全拼,不只是首个字母,含声母和韵母,汉字转拼音(全拼)
- 获得汉字字符串拼音首字母
- 请高手帮帮忙!!
- 远程桌面+花生壳控制adsl动态ip用户的电脑
- Java 专业人士必备的书籍和网站列表
- 微软.net framework 核心库代码开源了,在VS2008中查看.net framework的源代码
- EXCEL某列长度超过255个字符导入SQL SERVER2005的处理方法
- C#获得汉字的首拼音
- 九张机
- September 16th Wednesday
- 学生管理系统 最新修改
- CSS中expression使用简介
- 惋惜
- B/S,C/S
- 安装MySQL-python(MySQLdb)时报错,找不到libmysqlclient_r.so.16动态连接库
- 如何在google中收录您的网站