返回字串的拼音首字母

//
file://函数名:gf_getfirstletter(string)
file://功能:返回字串的拼音首字母,支持混合字符串(可以包含非汉字)
file://参数:as_inputstring
file://返回值:string
file://created 大同 张和平 dtzhp@yeah.net
//
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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值