获取字符中中文首字字符


复制代码 代码如下:

<%
'获取字符中中文首字字符
'返回:A-Z ;123 ; ###
Public Function GetSpellChar(str)
Dim tmp
GetSpellChar = "@"
tmp = 65536 + Asc(str)
If (tmp >= 45217 And tmp <= 45252) Or (tmp = 65601) Or (tmp = 65633) Or (tmp = 37083) Then
GetSpellChar = "A1"
ElseIf (tmp >= 45253 And tmp <= 45760) Or (tmp = 65602) Or (tmp = 65634) Or (tmp = 39658) Then
GetSpellChar = "B1"
ElseIf (tmp >= 45761 And tmp <= 46317) Or (tmp = 65603) Or (tmp = 65635) Or (tmp = 33405) Then
GetSpellChar = "C1"
ElseIf (tmp >= 46318 And tmp <= 46930) Or (tmp = 61884) Or (tmp = 63468) Or (tmp = 65604) Or (tmp >= 36820
And tmp <= 38524) Or (tmp = 65636) Then
GetSpellChar = "D1"
ElseIf (tmp >= 46931 And tmp <= 47009) Or (tmp >= 46827 And tmp <= 46842) Or (tmp = 65605) Or (tmp = 65637)
Or (tmp = 61513) Then '46827 46833 46842
GetSpellChar = "E1"
ElseIf (tmp >= 47010 And tmp <= 47296) Or (tmp = 65606) Or (tmp = 65638) Or (tmp = 61320) Or (tmp = 63568) Or
(tmp = 36281) Then
GetSpellChar = "F1"
ElseIf (tmp >= 47297 And tmp <= 47613) Or (tmp = 65607) Or (tmp = 65639) Or (tmp = 35949) Or (tmp = 36089) Or
(tmp = 36694) Or (tmp = 34808) Then
GetSpellChar = "G1"
ElseIf (tmp >= 47614 And tmp <= 48118) Or (tmp = 59112) Or (tmp = 40296) Or (tmp = 65608) Or (tmp = 65640)
Then
GetSpellChar = "H1"
ElseIf (tmp = 65641) Or (tmp = 65609) Or (tmp = 65641) Then
GetSpellChar = "I1"
ElseIf (tmp >= 48119 And tmp <= 49061 And tmp <> 48739) Or (tmp >= 62430 And tmp <= 62430) Or (tmp = 65610)
Or (tmp = 65642) Or (tmp = 39048) Then
GetSpellChar = "J1"
ElseIf (tmp >= 49062 And tmp <= 49323) Or (tmp = 65611) Or (tmp = 65643) Then
GetSpellChar = "K1"
ElseIf (tmp >= 49324 And tmp <= 49895) Or (tmp >= 58838 And tmp <= 58838) Or (tmp = 65612) Or (tmp = 65644)
Or (tmp = 62418) Or (tmp = 48739) Then
GetSpellChar = "L1"
ElseIf (tmp >= 49896 And tmp <= 50370) Or (tmp = 63432) Or (tmp = 65613) Or (tmp = 65645) Then
GetSpellChar = "M1"
ElseIf (tmp >= 50371 And tmp <= 50613) Or (tmp = 65614) Or (tmp = 65646) Then
GetSpellChar = "N1"
ElseIf (tmp >= 50614 And tmp <= 50621) Or (tmp = 65615) Or (tmp = 65615) Or (tmp = 65647) Then
GetSpellChar = "O1"
ElseIf (tmp >= 50622 And tmp <= 50905) Or (tmp = 65616) Or (tmp = 65648) Then
GetSpellChar = "P1"
ElseIf (tmp >= 50906 And tmp <= 51386) Or (tmp >= 62659 And tmp <= 63172) Or (tmp = 63464) Or (tmp = 63226)
Or (tmp = 65617) Or (tmp = 65649) Then
GetSpellChar = "Q1"
ElseIf (tmp >= 51387 And tmp <= 51445) Or (tmp = 65618) Or (tmp = 65650) Then
GetSpellChar = "R1"
ElseIf (tmp >= 51446 And tmp <= 52217) Or (tmp = 65619) Or (tmp = 65651) Or (tmp = 34009) Then
GetSpellChar = "S1"
ElseIf (tmp >= 52218 And tmp <= 52697) Or (tmp = 65620) Or (tmp = 65652) Then
GetSpellChar = "T1"
ElseIf (tmp = 65621) Or (tmp = 65653) Then
GetSpellChar = "U1"
ElseIf (tmp = 65622) Or (tmp = 65654) Then
GetSpellChar = "V1"
ElseIf (tmp >= 52698 And tmp <= 52979) Or (tmp = 65623) Or (tmp = 65655) Then
GetSpellChar = "W1"
ElseIf (tmp >= 52980 And tmp <= 53688) Or (tmp = 63182) Or (tmp = 65624) Or (tmp = 65656) Then
GetSpellChar = "X1"
ElseIf (tmp >= 53689 And tmp <= 54480) Or (tmp = 65625) Or (tmp = 65657) Then
GetSpellChar = "Y1"
ElseIf (tmp >= 54481 And tmp <= 62383 And tmp <> 59112 And tmp <> 58838 And tmp <> 57566) Or (tmp = 65626) Or
(tmp = 65658) Or (tmp = 38395) Or (tmp = 39783) Then
GetSpellChar = "Z1"
End If
If (tmp >= 65601 And tmp <= 65658) Then GetSpellChar = UCase(Left(Trim(str), 1)) '字母
If (tmp >= 65584 And tmp <= 65593) Then GetSpellChar = "123" '数字
'Response.Write(tmp)
End Function
response.write GetSpellChar("脚")
response.write GetSpellChar("本")
response.write GetSpellChar("之")
%>



相关阅读:
Highslide JS
怎样设置Win XP下安装打印机驱动程序
Oracle数据库中7个疑难问题的解决方法
Fedra7 建立DHCP服务器
CSS Hack 与兼容性讨论
不用安装客户端连接sql server 2000
怎样才能成为PHP高手?学会“懒惰”的编程
sqlserver 游标的简单示例
Windows7两个有趣的很搞笑的错误
使用split分割多字符的字符串的方法
通用的加入收藏夹代码支持IE Firefox等浏览器
Oracle10gR2中调整user commit
8款非常棒的响应式jQuery 幻灯片插件推荐
asp中使用mysql数据库的注意实现
快速导航
PHP MySQL HTML CSS JavaScript MSSQL AJAX .NET JSP Linux Mac ASP 服务器 SQL jQuery C# C++ java Android IOS oracle MongoDB SQLite wamp 交通频道 作文范文 高一生物教师学期工作总结 20个生活小贴士,让你的生活得更加健康快乐 寂寞光景 白求恩活动演讲稿:我的唯一希望—多做贡献 励志故事:多元思维,制造需求 心中的思念——寄二哥二嫂 如果我是啄木鸟 曾经沧海难为水 除却巫山不是云 详解 教师教育工作心得:不要吝啬我们的鼓励 习惯了寂寞!——赵艳芳 爱、谁会领悟彻底、 2016党支部三会一课工作计划 人代会闭幕辞 县长个人工作总结 怀念一起走过的日子 记一次烧烤活动作文500字 买水作文400字 坐飞机的感觉真爽 这样下去能行吗? 中专班主任工作总结(一) 初中初一作文300字:捕 鱼 :- 死缠烂打的回忆 写上一片心声 小学四年级作文400字:刚刚开通了小屋,来转转吧! 个性签名伤感友谊 っ 站在这城市的寂静处,让一切喧嚣走远。 读书演讲稿《书香伴我行》 第一份工作就要有含金量 小学五年级作文550字:一份礼物 渔父词(其十四) 渐渐远去 八拜之交的典故|八拜之交是指哪八拜 火药表弟作文400字 写人作文:如果他不是他(高一)作文1200字 2016分公司注销承诺书 《祖父的园子》(A、B案) 2014有关新年心愿的作文 一个穷人是从什么时候开始有钱的? 2016升学答谢宴主持词范文 不良笑花作文1600字 小学四年级作文400字:赛尔号 《自我规划的展示》 教案(会员上传) 人教版高中第一册四单元作文:精神的决战作文1000字 妇代会工作总结 墨色康乃馨 舞蹈兴趣小组计划 殇作文 小燕子学飞作文450字 2011年机关党员干部春训工作体会 文字,是与生命的狭路相逢

Copyright © 2016 phpStudy |