返回字串的拼音首字母
2024-07-21 02:09:08
供稿:网友
网站运营seo文章大全提供全面的站长运营经验及seo技术!
//////////////////////////////////////////////////////////////
file://函数名:gf_getfirstletter(string)
file://功能:返回字串的拼音首字母,支持混合字符串(可以包含非汉字)
file://参数:as_inputstring
file://返回值:string
file://created 大同 张和平 [email protected]
//////////////////////////////////////////////////////////////
long i
string ls_ch,ls_returnstr
for i=1 to len(as_inputstring) file://依次处理as_inputstring中每个字符
ls_ch=mid(as_inputstring , i , 1)
if ls_ch < "啊" then // 非汉字
ls_returnstr = ls_returnstr+ls_ch // 不变
elseif ls_ch >= "啊" and ls_ch <= "座" then file://处理一级汉字
choose case ls_ch
case is >= '匝'
ls_returnstr += "z"
case is >= '压'
ls_returnstr += "y"
case is >= '昔'
ls_returnstr += "x"
case is >= '挖'
ls_returnstr += "w"
case is >= '塌'
ls_returnstr += "t"
case is >= '撒'
ls_returnstr += "s"
case is >= '然'
ls_returnstr += "r"
case is >= '期'
ls_returnstr += "q"
case is >= '啪'
ls_returnstr += "p"
case is >= '哦'
ls_returnstr += "o"
case is >= '拿'
ls_returnstr += "n"
case is >= '妈'
ls_returnstr += "m"
case is >= '垃'
ls_returnstr += "l"
case is >= '喀'
ls_returnstr += "k"
case is >= '击'
ls_returnstr += "j"
case is >= '哈'
ls_returnstr += "h"
case is >= '噶'
ls_returnstr += "g"
case is >= '发'
ls_returnstr += "f"
case is >= '蛾'
ls_returnstr += "e"
case is >= '搭'
ls_returnstr += "d"
case is >= '擦'
ls_returnstr += "c"
case is >= '芭'
ls_returnstr += "b"
case is >= '啊'
ls_returnstr += "a"
end choose
// elseif ls_ch > "座" then file://处理一级汉字
// select py into :ls_py from piyin where hanzi = :ls_ch;
end if
// i = i+1 file://pb8不用此句,而pb65要用, 指向下一个汉字
next
return ls_returnstr