- 浏览: 135984 次
- 性别:
- 来自: 上海
最新评论
#region GetChineseSpell获取汉字拼音的第一个字母 //获取汉字拼音的第一个字母 static public string GetChineseSpell(string strText) { int len = strText.Length; string myStr = ""; for (int i = 0; i < len; i++) { if (getCheck(strText.Substring(i, 1)))//判断这个字符是否是汉字 myStr += getSpell(strText.Substring(i, 1)); } return myStr; } protected static bool getCheck(string text) { return Regex.IsMatch(text, "[\u4e00-\u9fa5]"); } static public string[] GetChineseSpell(string[] strText) { int len = strText.Length; string[] myStr = null; for (int i = 0; i < len; i++) { myStr[i] = getSpell(strText[i]); } 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; } #endregion
发表评论
-
FLASH和DIV的优先级
2012-06-15 17:13 794广告,两个动画,FLASH总挡住DIV,用这个办法把它优先级放 ... -
C# 获得对象属性和属性值 C#利用反射遍历对象的属性和属性值
2012-04-19 11:07 25217有一段时间没有写了 因为工作有点忙,没有时间去整理 实体类 ... -
asp.net的Request.ServerVariables参数说明
2011-08-28 20:29 2871Request.ServerVariables[&qu ... -
DBHelper
2011-01-11 19:22 902就是个DBHelper -
IIS 服务器信息
2011-01-04 11:49 762Label1.Text = "服务器名称:" ... -
asp.net GridView
2010-11-10 10:58 788protected void init()//初始化数据 ... -
asp.net 上传图片保存缩略图 图片水印
2010-10-27 10:25 969using System; using System.Dat ... -
asp.net中的三元运算符
2010-10-11 10:00 924<asp:TextBox ID=&quo ... -
asp.net Eval 的使用方法
2010-09-28 15:25 2350<%# Bind("Subject&quo ... -
asp.net DataTable 导出,导出 excel , NPOI 使用方法
2010-09-28 10:34 9556官网:http://npoi.codeplex.com/ ... -
asp.net 输出 xml
2010-09-13 20:38 1946protected void Page_Load( ... -
asp.net cookie 操作 写入 与 读取
2010-09-13 20:33 932protected void init() ... -
AspNetPager分页样式
2010-09-01 15:57 4776AspNetPager分页样式 AspNetPa ... -
aspnetpager 分页控件
2010-08-31 15:58 847<%@ Page Language=& ... -
使用.net-Synchronized属性进行静态方法的同步
2010-08-25 09:57 1093使用.net属性进行静态方法的同步本文介绍使用.net得Syn ... -
asp.net 输出RSS aspx 输入XML
2010-08-06 09:51 1159.aspx页面只留下: <%@ Page Langua ... -
asp.net 一般处理程序使用 session
2010-08-05 22:43 1031在ashx一般处理程序文件中不能使用session和reque ... -
获得web服务器虚拟目录对应的物理路径
2010-08-02 13:25 1543Page.Server.MapPaht("file& ... -
asp.net mysql c# 实用mysql
2010-07-30 23:46 1322在网上看到一篇关于Asp.net和mysql的文章,mysql ... -
asp.net邮件发送 asp.net邮件群发
2010-07-30 21:23 2074public void MailSend(string[] m ...
相关推荐
ASP.NET连接各种数据库的连接字符串总结,包括Access ,Excel,SQL Server,ODBC,Oracle
asp.net c# 电子商务网站asp.net c# 电子商务网站
基于ASP.NET C#的全源码完整OA,包括人事管理、用户权限管理、信息发布、用车管理等内容。
asp.net C# 利用FTP 远程下载文件到指定盘符`
asp.net c# String类添加按字节截取字符串的扩展方法
管理系统 mvc asp.net c# demo 示例 代码
Asp.net 2.0 各种数据库连接字符串集合
asp.net C# PDF阅读器源码,asp.net C# PDF阅读器源码
asp.net c# 统计图 GoogleChartSharp 含实例
asp.net C# 网站 项目 我们老师写的,,很不错!为大家提供一个平台!!!
ASP.NET Oracle字符串连接符
asp.net C# 物业管理系统asp.net C# 物业管理系统asp.net C# 物业管理系统asp.net C# 物业管理系统
在.Net上用字符串动态创建控件是通过反射来实现,本文就是讲述在.NET上如何根据字符串动态创建控件。
ASP.NET c# 封装常用到的js通用函数ASP.NET c# 封装常用到的js通用函数ASP.NET c# 封装常用到的js通用函数ASP.NET c# 封装常用到的js通用函数ASP.NET c# 封装常用到的js通用函数ASP.NET c# 封装常用到的js通用函数
ASP.NET C# 在线音乐网站 下载。 其主要功能有:会员管理,添加歌曲,点歌管理,歌曲查找,留言系统,网站管理等。 音乐网站
ASP.NET C# 餐饮消费管理系统 源代码 用来学习 帮助项目经验少的同学增加经验。
asp.net截取字符串方法 使用字节精确计算 计算空格 直接复制使用 简单
asp.net 下用c# 将excel导入网页,可以运行,自己编写的
全部都是面试的宝典; c# asp.net .net .net面试题 c#面试题 c# asp.net .net .net面试题 c#面试题
C#开发教程C#开发教程C#开发教程 asp.net C# asp.net C#asp.net C#