CSDN博客

img aspczlover

汉字转换成拼音

发表于2004/10/2 4:23:00  633人阅读

分类: 功能函数

比如想实现搜索“L”就能搜索出姓“刘的”“李的”“林的”

<%
'测试
response.write  CheckStringFirst(“刘的“)      '打印出L

Function CheckStringFirst(char)    '[45217,65184]为汉字,[65584,65593]为数字
 char = Mid(char,1,1)
 FirstChar = 65536 + asc(char)
 
 if FirstChar >= 65584 and FirstChar <= 65593 then   '判断是否为数字
  getpychar = "Num"
 end if
 
 if FirstChar < 45217 or FirstChar > 65184 or FirstChar < 65584 or FirstChar > 65593 then   '判断是否为特殊字符!
  getpychar = "Ohter"
 end if
 
 if FirstChar > 45217 and First < 65184 then
  if(FirstChar>=45217 and FirstChar<=45252) then getpychar= "A"
  if(FirstChar>=45253 and FirstChar<=45760) then getpychar= "B"
  if(FirstChar>=45761 and FirstChar<=46317) then getpychar= "C"
  if(FirstChar>=46318 and FirstChar<=46825) then getpychar= "D"
  if(FirstChar>=46826 and FirstChar<=47009) then getpychar= "E"
  if(FirstChar>=47010 and FirstChar<=47296) then getpychar= "F"
  if(FirstChar>=47297 and FirstChar<=47613) then getpychar= "G"
  if(FirstChar>=47614 and FirstChar<=48118) then getpychar= "H"
  if(FirstChar>=48119 and FirstChar<=49061) then getpychar= "J"
  if(FirstChar>=49062 and FirstChar<=49323) then getpychar= "K"
  if(FirstChar>=49324 and FirstChar<=49895) then getpychar= "L"
  if(FirstChar>=49896 and FirstChar<=50370) then getpychar= "M"
  if(FirstChar>=50371 and FirstChar<=50613) then getpychar= "N"
  if(FirstChar>=50614 and FirstChar<=50621) then getpychar= "O"
  if(FirstChar>=50622 and FirstChar<=50905) then getpychar= "P"
  if(FirstChar>=50906 and FirstChar<=51386) then getpychar= "Q"
  if(FirstChar>=51387 and FirstChar<=51445) then getpychar= "R"
  if(FirstChar>=51446 and FirstChar<=52217) then getpychar= "S"
  if(FirstChar>=52218 and FirstChar<=52697) then getpychar= "T"
  if(FirstChar>=52698 and FirstChar<=52979) then getpychar= "W"
  if(FirstChar>=52980 and FirstChar<=53688) then getpychar= "X"
  if(FirstChar>=53689 and FirstChar<=54480) then getpychar= "Y"
  if(FirstChar>=54481 and FirstChar<=65184) then getpychar= "Z"
 end if
 
 char = getpychar
End Function
%>
阅读全文
0 0

相关文章推荐

img
取 消
img