获得汉字的拼音简码

      数据库学习笔记 2009-4-19 23:56


获得汉字的拼音简码
本文来源于【梅子论坛临时文章系统】 网站地址:http://www.meizvfp.com/article.asp?id=2



*过程名为pyjm
*调用格式为 JM=pyjm(参数)
*假若是想求表单中文本框TEXT1中的汉字拼音简码,调用方式为JM=pyjm(THISFORM.TEXT1.VALUE)
*变量JM就是所求的拼音简码
PROCEDURE pyjm
PARAMETERS strg
le=LEN(strg)
jm=""
for m=1 to le step 2
mystr=substr(strg,m,2)
If Asc(mystr) > 0
If Asc(Left(mystr,2)) < Asc("啊")
py = Left(mystr,2)
EndIf
If Asc(Left(mystr, 2)) >= Asc("啊") And Asc(Left(mystr, 1)) < Asc("芭")
py = "A"
EndIf
If Asc(Left(mystr, 2)) >= Asc("芭") And Asc(Left(mystr, 1)) < Asc("擦")
py = "B"
EndIf
If Asc(Left(mystr, 2)) >= Asc("擦") And Asc(Left(mystr, 1)) < Asc("搭")
py = "C"
Endif
If Asc(Left(mystr, 2)) >= Asc("搭") And Asc(Left(mystr, 1)) < Asc("蛾")
py = "D"
Endif
If Asc(Left(mystr, 2)) >= Asc("蛾") And Asc(Left(mystr, 1)) < Asc("发")
py = "E"
Endif
If Asc(Left(mystr, 2)) >= Asc("发") And Asc(Left(mystr, 2)) < Asc("噶")
py = "F"
Endif
If Asc(Left(mystr, 2)) >= Asc("噶") And Asc(Left(mystr, 2)) < Asc("哈")
py = "G"
Endif
If Asc(Left(mystr, 2)) >= Asc("哈") And Asc(Left(mystr, 2)) < Asc("击")
py = "H"
Endif
If Asc(Left(mystr, 2)) >= Asc("击") And Asc(Left(mystr, 2)) < Asc("喀")
py = "J"
Endif
If Asc(Left(mystr, 2)) >= Asc("喀") And Asc(Left(mystr, 2)) < Asc("垃") Or mystr='剀'
py = "K"
Endif
If Asc(Left(mystr, 2)) >= Asc("垃") And Asc(Left(mystr, 2)) < Asc("妈")
py = "L"
Endif
If Asc(Left(mystr, 2)) >= Asc("妈") And Asc(Left(mystr, 2)) < Asc("拿")
py = "M"
Endif
If Asc(Left(mystr, 2)) >= Asc("拿") And Asc(Left(mystr, 2)) < Asc("哦")
py = "N"
Endif
If Asc(Left(mystr, 2)) >= Asc("哦") And Asc(Left(mystr, 2)) < Asc("啪")
py = "O"
Endif
If Asc(Left(mystr, 2)) >= Asc("啪") And Asc(Left(mystr, 2)) < Asc("期") or mystr='翩'
py = "P"
Endif
If Asc(Left(mystr, 2)) >= Asc("期") And Asc(Left(mystr, 2)) < Asc("然")
py = "Q"
Endif
If Asc(Left(mystr, 2)) >= Asc("然") And Asc(Left(mystr, 2)) < Asc("撒")
py = "R"
Endif
If Asc(Left(mystr, 2)) >= Asc("撒") And Asc(Left(mystr, 2)) < Asc("塌")
py = "S"
Endif
If Asc(Left(mystr, 2)) >= Asc("塌") And Asc(Left(mystr, 2)) < Asc("挖")
py = "T"
Endif
If Asc(Left(mystr, 2)) >= Asc("挖") And Asc(Left(mystr, 2)) < Asc("昔") Or mystr='炜'
py = "W"
Endif
If Asc(Left(mystr, 2)) >= Asc("昔") And Asc(Left(mystr, 2)) < Asc("压") Or mystr='馨'
py = "X"
Endif
If Asc(Left(mystr, 2)) >= Asc("压") And Asc(Left(mystr, 2)) < Asc("匝") or mystr='懿'
py = "Y"
Endif
If Asc(Left(mystr, 2)) >= Asc("匝") and mystr!='馨' and mystr!='炜' and mystr!='剀' and mystr!='翩' and mystr!='懿'
py = "Z"
Endif
If upper(mystr) <= "Z" And upper(mystr) >= "A"
py=upper(mystr)
Endif
Endif
jm=jm+py
endfor
RETURN jm
ENDPROC
本文来源于【梅子论坛临时文章系统】 网站地址:http://www.meizvfp.com/article.asp?id=2


 
 
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}