用C#写的汉语转拼音缩写的例子
来源:互联网 发布:sql update嵌套select 编辑:程序博客网 时间:2024/05/16 19:42
以前用C#写的一个汉语转拼音所写的例子,拿出来与大家共享下,呵呵,有什么好的改进,希望大家共同探讨:原文地址
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class 汉字转拼音函数_Default : System.Web.UI.Page
...{
protected void Page_Load(object sender, EventArgs e)
...{
this.lbl_Show.Text = GetPYString("郑玉路");
}
/**//// <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 >= 33 && (int)c <= 126)
...{//字母和符号原样保留
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[2];
array = System.Text.Encoding.Default.GetBytes(c);
int i = (short)(array[0] - '
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class 汉字转拼音函数_Default : System.Web.UI.Page
...{
protected void Page_Load(object sender, EventArgs e)
...{
this.lbl_Show.Text = GetPYString("郑玉路");
}
/**//// <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 >= 33 && (int)c <= 126)
...{//字母和符号原样保留
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[2];
array = System.Text.Encoding.Default.GetBytes(c);
int i = (short)(array[0] - '
- 用C#写的汉语转拼音缩写的例子
- 汉语转拼音缩写
- C#中汉语转拼音
- C#中汉语转拼音
- 基于PHP的汉语转拼音类
- 基于PHP的汉语转拼音类
- 汉语转拼音的工具类
- 获取汉语字串的拼音
- 中文转拼音缩写 c#
- C#汉字转拼音缩写
- 汉字转拼音缩写的函数(VB)
- 汉字转拼音缩写的函数(VB)
- 汉字转拼音缩写的代码
- 汉字转拼音缩写的函数(C#)
- 汉字转拼音缩写的函数(VB)
- 汉字转拼音缩写的函数(C#)
- 汉字转拼音缩写的函数(C#)
- 汉字转拼音缩写的函数(C#)
- FileDisk源码分析
- C++ 通过WIN32 API 获取逻辑磁盘详细信息
- 互联网创业的十种模式
- JavaScript中的闭包(Closure)
- Pku acm 2492 A Bug's Life数据结构题目解题报告(十)---- 并查集的应用
- 用C#写的汉语转拼音缩写的例子
- 简单多线程实现代码(参考卖票代码)
- 简单多线程实现代码(参考卖票代码)
- Tomcat5.0配置MySql数据库连接源
- 筛选简历
- 利用 SHDocVw::IShellWindowsPtr m_spSHWinds 遍历所有IE浏览器,得到里面的所有元素 还有一个是查找IE窗口里的submit按钮,模拟点击
- UDP的简易聊天程序图型多线程版 带原代码
- 回文数
- 研究出来了,不过可能不规范 呵呵