1 <% 2 '****************************** 3 '函数:getpychar(char) 4 '参数:char,任意中文字符或句子 5 '作者:阿里西西 6 '日期:2007/7/15 7 '描述:取得中文句子头一个字的大写拼音字母 8 '示例:getpychar("欢迎访问阿里西西") 9 '****************************** 10 Function getpychar(char) 11 Dim tmp 12 tmp=65536+Asc(char) 13 14 If(tmp>=45217 And tmp<=45252) Then 15 getpychar= "A" 16 ElseIF(tmp>=45253 And tmp<=45760) Then 17 getpychar= "B" 18 ElseIF(tmp>=45761 And tmp<=46317) Then 19 getpychar= "C" 20 ElseIF(tmp>=46318 And tmp<=46825) Then 21 getpychar= "D" 22 ElseIF(tmp>=46826 And tmp<=47009) Then 23 getpychar= "E" 24 ElseIF(tmp>=47010 And tmp<=47296) Then 25 getpychar= "F" 26 ElseIF(tmp>=47297 And tmp<=47613) Then 27 getpychar= "G" 28 ElseIF(tmp>=47614 And tmp<=48118) Then 29 getpychar= "H" 30 ElseIF(tmp>=48119 And tmp<=49061) Then 31 getpychar= "J" 32 ElseIF(tmp>=49062 And tmp<=49323) Then 33 getpychar= "K" 34 ElseIF(tmp>=49324 And tmp<=49895) Then 35 getpychar= "L" 36 ElseIF(tmp>=49896 And tmp<=50370) Then 37 getpychar= "M" 38 ElseIF(tmp>=50371 And tmp<=50613) Then 39 getpychar= "N" 40 ElseIF(tmp>=50614 And tmp<=50621) Then 41 getpychar= "O" 42 ElseIF(tmp>=50622 And tmp<=50905) Then 43 getpychar= "P" 44 ElseIF(tmp>=50906 And tmp<=51386) Then 45 getpychar= "Q" 46 ElseIF(tmp>=51387 And tmp<=51445) Then 47 getpychar= "R" 48 ElseIF(tmp>=51446 And tmp<=52217) Then 49 getpychar= "S" 50 ElseIF(tmp>=52218 And tmp<=52697) Then 51 getpychar= "T" 52 ElseIF(tmp>=52698 And tmp<=52979) Then 53 getpychar= "W" 54 ElseIF(tmp>=52980 And tmp<=53640) Then 55 getpychar= "X" 56 ElseIF(tmp>=53689 And tmp<=54480) Then 57 getpychar= "Y" 58 ElseIF(tmp>=54481 And tmp<=62289) Then 59 getpychar= "Z" 60 Else '如果不是中文,则不处理 61 getpychar= char 62 End If 63 64 End Function 65 66 dim strname,strZi 67 strname = "奥斯特洛夫斯基" 68 69 dim i 70 for i=1 to len(strname) 71 strZi = Mid(strname, i, 1) 72 response.write(getpychar(strZi)) 73 next 74 response.write("<br/>"+strname) 75 76 %>
方便录入数据时的自动完成。