All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
用perl来解析你的php文档_[PHP教程]
ASP.NET,2.0下的条件编译_[Asp.Net教程]
SQL,Server,7.0,入门(六)_mssql学习_编程技术
asp.net实现DropDownList、ListBox无刷新三级联动的方法_[Asp.Net教程]
Delphi触摸屏系统
c#中GDI+图形图像:GDI+中的区域使用方法
区别和认识.Net四个判等函数_.net资料_编程技术
php获取文件信息_php资料_编程技术
C#中TreeView控件应用实例
Excel在.Net下驻留内存的解决方法_[Asp.Net教程]
Reading number is top 10 pictures
2015中美最新武器装备巅峰对决!
人物写真-谢楠
50个至今影响世界的德国发明
Absolutely shocked. National geographic 50 animal photographys1
看如何给单纯的少女洗脑
8090后结婚的各种XX事
到南昌西站了3
Sora aoi mirror memorial classics3
初吻给了谁?
Soong ching ling's former residence2
Download software ranking
Call Of Duty5
双旗镇刀客A
Tram sex maniac 2 (H) rar bag17
Boxer Classic video3
WebService在.NET中的实战应用教学视频 → 第2集
Ashlynn Video5
apache-tomcat-6.0.33
VeryCD电驴(EasyMule) V1.1.9 Build09081
Popkart Cracked versions Mobile phone games
Proficient in JavaScript
delv published in(发表于) 2014/1/10 6:33:07 Edit(编辑)
获得汉字字符串的首个拼音字母的缩写_[Asp.Net教程]

获得汉字字符串的首个拼音字母的缩写_[Asp.Net教程]

获得汉字字符串的首个拼音字母的缩写_[Asp.Net教程]

标题可能不太清楚,实现的功能如下:我爱中国-WAZG
1。汉字字符与英文字母之间区别
标准的asc表不包含汉字字符,因为一个asc字符只有1byte,就是8bit,8bit所能代表的数字范围,如果是有符号的好,因该为-128-127,无符号的话,应该为0-255。而我们知道,一个汉字字符,应该占有2个byte,表示范围应该为-32768-32767,所以汉字的asc,举例一段bit: 11002111,11111101它所代表的字符,应该超过了asc所能表述的范围,这时候就会产生溢出。所以占有两个byte的汉字字符的asc码应该为负的。
2.功能实现
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace ConsoleApplication1
6{
7 class Program
8 {
9 static void Main(string[] args)
10 {
11 Console.WriteLine(GetChineseFirstChar("我a*%爱你中国"));;
12 }
13 static string GetChineseFirstChar(string chineseStr)
14 {
15 StringBuilder sb = new StringBuilder();
16 int length = chineseStr.Length;
17 for (int i = 0; i < length; i++)
18 {
19 char chineseChar = chineseStr[i];
20 sb.Append(GetpyChar(chineseChar));
21 }
22 return sb.ToString();
23 }
24 static string GetpyChar(char c)
25 {
26 int ascCode = Microsoft.VisualBasic.Strings.Asc(c);
27 int temp = 65536 + ascCode;
28 if (temp >= 45217 && temp <= 45252)
29 {
30 return "A";
31 }
32 else if (temp >= 45253 && temp <= 45760)
33 {
34 return "B";
35 }
36 else if (temp >= 45761 && temp <= 46317)
37 {
38 return "C";
39 }
40 else if (temp >= 46318 && temp <= 46825)
41 {
42 return "D";
43 }
44
45
46 else if (temp >= 46826 && temp <= 47009)
47 {
48 return "E";
49 }
50 else if (temp >= 47010 && temp <= 47296)
51 {
52 return "F";
53 }
54 else if (temp >= 47297 && temp <= 47613)
55 {
56 return "G";
57 }
58 else if (temp >= 47614 && temp <= 48118)
59 {
60 return "H";
61 }
62 else if (temp >= 48119 && temp <= 49061)
63 {
64 return "J";
65 }
66 else if (temp >= 49062 && temp <= 49323)
67 {
68 return "K";
69 }
70 else if (temp >= 49324 && temp <= 49895)
71 {
72 return "L";
73 }
74 else if (temp >= 49896 && temp <= 50370)
75 {
76 return "M";
77 }
78 else if (temp >= 50371 && temp <= 50613)
79 {
80 return "N";
81 }
82 else if (temp >= 50614 && temp <= 50621)
83 {
84 return "O";
85 }
86 else if (temp >= 50622 && temp <= 50905)
87 {
88 return "P";
89 }
90 else if (temp >= 50906 && temp <= 51386)
91 {
92 return "Q";
93 }
94 else if (temp >= 51387 && temp <= 51445)
95 {
96 return "R";
97 }
98 else if (temp >= 51446 && temp <= 52217)
99 {
100 return "S";
101 }
102 else if (temp >= 52218 && temp <= 52697)
103 {
104 return "T";
105 }
106 else if (temp >= 52698 && temp <= 52979)
107 {
108 return "W";
109 }
110 else if (temp >= 52980 && temp <= 53688)
111 {
112 return "X";
113 }
114 else if (temp >= 53689 && temp <= 54480)
115 {
116 return "Y";
117 }
118 else if (temp >= 54481 && temp <= 62289)
119 {
120 return "Z";
121 }
122 else
123 {
124 return c.ToString();
125 }
126 }
127 }
128}
129


来源:网络







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.