我在网上找了一个,支持大字符集,在VB.net下通过。不知在foxtable下能不能用:
Public Function GetPY(ByVal strWords As String) As String
'返回汉字的拼音首字母大写字符串,支持 GBK 大字符集
Dim sReturn, sOneTxt As String
Dim i As Integer
For i = 0 To strWords.Length - 1
sOneTxt = strWords.Substring(i, 1)
sReturn = sReturn + GetGbkX(sOneTxt)
Next
Return sReturn
End Function
Private Function GetGbkX(ByVal str As String) As String
If str.CompareTo("吖") < 0 Then
Return str
End If
If str.CompareTo("八") < 0 Then
Return "A"
End If
If str.CompareTo("嚓") < 0 Then
Return "B"
End If
If str.CompareTo("咑") < 0 Then
Return "C"
End If
If str.CompareTo("妸") < 0 Then
Return "D"
End If
If str.CompareTo("发") < 0 Then
Return "E"
End If
If str.CompareTo("旮") < 0 Then
Return "F"
End If
If str.CompareTo("铪") < 0 Then
Return "G"
End If
If str.CompareTo("讥") < 0 Then
Return "H"
End If
If str.CompareTo("咔") < 0 Then
Return "J"
End If
If str.CompareTo("垃") < 0 Then
Return "K"
End If
If str.CompareTo("嘸") < 0 Then
Return "L"
End If
If str.CompareTo("拏") < 0 Then
Return "M"
End If
If str.CompareTo("噢") < 0 Then
Return "N"
End If
If str.CompareTo("妑") < 0 Then
Return "O"
End If
If str.CompareTo("七") < 0 Then
Return "P"
End If
If str.CompareTo("亽") < 0 Then
Return "Q"
End If
If str.CompareTo("仨") < 0 Then
Return "R"
End If
If str.CompareTo("他") < 0 Then
Return "S"
End If
If str.CompareTo("哇") < 0 Then
Return "T"
End If
If str.CompareTo("夕") < 0 Then
Return "W"
End If
If str.CompareTo("丫") < 0 Then
Return "X"
End If
If str.CompareTo("帀") < 0 Then
Return "Y"
End If
If str.CompareTo("咗") < 0 Then
Return "Z"
End If
Return str
End Function