返回字串的拼音首字母 (轉)

worldblog發表於2007-12-15
返回字串的拼音首字母 (轉)[@more@]

//////////////////////////////////////////////////////////////
數名:gf_getfirstletter(string)
能:返回字串的拼音首字母,支援混合字串(可以包含非漢字)
數:as_inputstring
回值:string
大同 張和平 to:dtzhp@yeah">dtzhp@yeah.net
//////////////////////////////////////////////////////////////
long i
string ls_ch,ls_returnStr
For i=1 to Len(as_InputString)  次處理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  理一級漢字
  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  理一級漢字
//  py into :ls_py from piyin where hanzi = :ls_ch;
   End if
//  i = i+1  不用此句,而PB65要用, 指向下一個漢字

Next 
RETURN ls_returnStr

 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-993813/,如需轉載,請註明出處,否則將追究法律責任。

相關文章