手机
当前位置:查字典教程网 >编程开发 >ASP教程 >获取字符中中文首字字符
获取字符中中文首字字符
摘要:复制代码代码如下:=45217Andtmp=45253Andtmp=45761Andtmp=46318Andtmp=36820Andtmp=...

复制代码 代码如下:

<%

'获取字符中中文首字字符

'返回:A-Z;123;###

PublicFunctionGetSpellChar(str)

Dimtmp

GetSpellChar="@"

tmp=65536+Asc(str)

If(tmp>=45217Andtmp<=45252)Or(tmp=65601)Or(tmp=65633)Or(tmp=37083)Then

GetSpellChar="A1"

ElseIf(tmp>=45253Andtmp<=45760)Or(tmp=65602)Or(tmp=65634)Or(tmp=39658)Then

GetSpellChar="B1"

ElseIf(tmp>=45761Andtmp<=46317)Or(tmp=65603)Or(tmp=65635)Or(tmp=33405)Then

GetSpellChar="C1"

ElseIf(tmp>=46318Andtmp<=46930)Or(tmp=61884)Or(tmp=63468)Or(tmp=65604)Or(tmp>=36820

Andtmp<=38524)Or(tmp=65636)Then

GetSpellChar="D1"

ElseIf(tmp>=46931Andtmp<=47009)Or(tmp>=46827Andtmp<=46842)Or(tmp=65605)Or(tmp=65637)

Or(tmp=61513)Then'468274683346842

GetSpellChar="E1"

ElseIf(tmp>=47010Andtmp<=47296)Or(tmp=65606)Or(tmp=65638)Or(tmp=61320)Or(tmp=63568)Or

(tmp=36281)Then

GetSpellChar="F1"

ElseIf(tmp>=47297Andtmp<=47613)Or(tmp=65607)Or(tmp=65639)Or(tmp=35949)Or(tmp=36089)Or

(tmp=36694)Or(tmp=34808)Then

GetSpellChar="G1"

ElseIf(tmp>=47614Andtmp<=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>=48119Andtmp<=49061Andtmp<>48739)Or(tmp>=62430Andtmp<=62430)Or(tmp=65610)

Or(tmp=65642)Or(tmp=39048)Then

GetSpellChar="J1"

ElseIf(tmp>=49062Andtmp<=49323)Or(tmp=65611)Or(tmp=65643)Then

GetSpellChar="K1"

ElseIf(tmp>=49324Andtmp<=49895)Or(tmp>=58838Andtmp<=58838)Or(tmp=65612)Or(tmp=65644)

Or(tmp=62418)Or(tmp=48739)Then

GetSpellChar="L1"

ElseIf(tmp>=49896Andtmp<=50370)Or(tmp=63432)Or(tmp=65613)Or(tmp=65645)Then

GetSpellChar="M1"

ElseIf(tmp>=50371Andtmp<=50613)Or(tmp=65614)Or(tmp=65646)Then

GetSpellChar="N1"

ElseIf(tmp>=50614Andtmp<=50621)Or(tmp=65615)Or(tmp=65615)Or(tmp=65647)Then

GetSpellChar="O1"

ElseIf(tmp>=50622Andtmp<=50905)Or(tmp=65616)Or(tmp=65648)Then

GetSpellChar="P1"

ElseIf(tmp>=50906Andtmp<=51386)Or(tmp>=62659Andtmp<=63172)Or(tmp=63464)Or(tmp=63226)

Or(tmp=65617)Or(tmp=65649)Then

GetSpellChar="Q1"

ElseIf(tmp>=51387Andtmp<=51445)Or(tmp=65618)Or(tmp=65650)Then

GetSpellChar="R1"

ElseIf(tmp>=51446Andtmp<=52217)Or(tmp=65619)Or(tmp=65651)Or(tmp=34009)Then

GetSpellChar="S1"

ElseIf(tmp>=52218Andtmp<=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>=52698Andtmp<=52979)Or(tmp=65623)Or(tmp=65655)Then

GetSpellChar="W1"

ElseIf(tmp>=52980Andtmp<=53688)Or(tmp=63182)Or(tmp=65624)Or(tmp=65656)Then

GetSpellChar="X1"

ElseIf(tmp>=53689Andtmp<=54480)Or(tmp=65625)Or(tmp=65657)Then

GetSpellChar="Y1"

ElseIf(tmp>=54481Andtmp<=62383Andtmp<>59112Andtmp<>58838Andtmp<>57566)Or(tmp=65626)Or

(tmp=65658)Or(tmp=38395)Or(tmp=39783)Then

GetSpellChar="Z1"

EndIf

If(tmp>=65601Andtmp<=65658)ThenGetSpellChar=UCase(Left(Trim(str),1))'字母

If(tmp>=65584Andtmp<=65593)ThenGetSpellChar="123"'数字

'Response.Write(tmp)

EndFunction

response.writeGetSpellChar("脚")

response.writeGetSpellChar("本")

response.writeGetSpellChar("之")

%>

【获取字符中中文首字字符】相关文章:

在ASP编程中使用数组

读取目录下的文件得到一个数组

FSO操作示例(给初学者)

sql语句的一些集合

字符批量替换程序asp服务器版

ASP中一个字符串处理类

厉害的用Asp获取Dll加密新闻内容

asp 获取地址栏参数代码

ASP中有关双引号,单引号以及&号的解释

XMLHTTP利用POST发送表单时提交中文的问题

精品推荐
分类导航