Foxtable(狐表)用户栏目专家坐堂 → ★原getpy函数太弱智....请高手写个自定义getpy函数


  共有24793人关注过本帖树形打印复制链接

主题:★原getpy函数太弱智....请高手写个自定义getpy函数

帅哥哟,离线,有人找我吗?
fangling
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:82 积分:1202 威望:0 精华:0 注册:2008/9/1 17:51:00
  发帖心情 Post By:2009/3/1 13:42:00 [显示全部帖子]

我在网上找了一个,支持大字符集,在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


 回到顶部