• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

返回字串的拼音首字母

发布: 2007-7-02 11:08 | 作者: admin | 来源: | 查看: 23次 | 进入软件测试论坛讨论

领测软件测试网
//////////////////////////////////////////////////////////////
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

 

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:[email protected] 电话:010-51297073

软件测试 | 领测国际 | ISTQB | ISTQB官网 | TMMi | TMMi认证 | 国际软件测试工程师认证 | 领测软件测试网