打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
098.取得汉字拼音的第一个字母

'###############################################################

'函数作用:取得汉字拼音的第一个字母

'###############################################################

Private Function GetPYChar(a1 As String) As String

    Dim t1 As String

    If Asc(a1) < 0 Then

        t1 = Left(a1, 1)

        If Asc(t1) < Asc("啊") Then

            GetPYChar = " "

            Exit Function

        End If

        If Asc(t1) >= Asc("啊") And Asc(t1) < Asc("芭") Then

            GetPYChar = "A"

            Exit Function

        End If

        If Asc(t1) >= Asc("芭") And Asc(t1) < Asc("擦") Then

            GetPYChar = "B"

            Exit Function

        End If

        If Asc(t1) >= Asc("擦") And Asc(t1) < Asc("搭") Then

            GetPYChar = "C"

            Exit Function

        End If

        If Asc(t1) >= Asc("搭") And Asc(t1) < Asc("蛾") Then

            GetPYChar = "D"

            Exit Function

        End If

        If Asc(t1) >= Asc("蛾") And Asc(t1) < Asc("发") Then

            GetPYChar = "E"

            Exit Function

        End If

        If Asc(t1) >= Asc("发") And Asc(t1) < Asc("噶") Then

            GetPYChar = "F"

            Exit Function

        End If

        If Asc(t1) >= Asc("噶") And Asc(t1) < Asc("哈") Then

            GetPYChar = "G"

            Exit Function

        End If

        If Asc(t1) >= Asc("哈") And Asc(t1) < Asc("击") Then

            GetPYChar = "H"

            Exit Function

        End If

        If Asc(t1) >= Asc("击") And Asc(t1) < Asc("喀") Then

            GetPYChar = "J"

            Exit Function

        End If

        If Asc(t1) >= Asc("喀") And Asc(t1) < Asc("垃") Then

            GetPYChar = "K"

            Exit Function

        End If

        If Asc(t1) >= Asc("垃") And Asc(t1) < Asc("妈") Then

            GetPYChar = "L"

            Exit Function

        End If

        If Asc(t1) >= Asc("妈") And Asc(t1) < Asc("拿") Then

            GetPYChar = "M"

            Exit Function

        End If

        If Asc(t1) >= Asc("拿") And Asc(t1) < Asc("哦") Then

            GetPYChar = "N"

            Exit Function

        End If

        If Asc(t1) >= Asc("哦") And Asc(t1) < Asc("啪") Then

            GetPYChar = "O"

            Exit Function

        End If

        If Asc(t1) >= Asc("啪") And Asc(t1) < Asc("期") Then

            GetPYChar = "P"

            Exit Function

        End If

        If Asc(t1) >= Asc("期") And Asc(t1) < Asc("然") Then

            GetPYChar = "Q"

            Exit Function

        End If

        If Asc(t1) >= Asc("然") And Asc(t1) < Asc("撒") Then

            GetPYChar = "R"

            Exit Function

        End If

        If Asc(t1) >= Asc("撒") And Asc(t1) < Asc("塌") Then

            GetPYChar = "S"

            Exit Function

        End If

        If Asc(t1) >= Asc("塌") And Asc(t1) < Asc("挖") Then

            GetPYChar = "T"

            Exit Function

        End If

        If Asc(t1) >= Asc("挖") And Asc(t1) < Asc("昔") Then

            GetPYChar = "W"

            Exit Function

        End If

        If Asc(t1) >= Asc("昔") And Asc(t1) < Asc("压") Then

            GetPYChar = "X"

            Exit Function

        End If

        If Asc(t1) >= Asc("压") And Asc(t1) < Asc("匝") Then

            GetPYChar = "Y"

            Exit Function

        End If

        If Asc(t1) >= Asc("匝") Then

            GetPYChar = "Z"

            Exit Function

        End If

    Else

        If UCase(a1) <= "Z" And UCase(a1) >= "A" Then

            GetPYChar = UCase(Left(a1, 1))

        Else

            GetPYChar = " "

        End If

    End If

End Function

Private Function GetPYStr(ByVal S As String) As String

    Dim l As Long

    Dim sOut As String

    If S <> "" Then

        For l = 1 To Len(S)

            sOut = sOut & GetPYChar(Mid(S, l, 1))

        Next l

        GetPYStr = sOut

    End If

End Function

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
得到汉字的拼音首字母
Excel 汉字转拼音
RSA加密算法在VB中的实现
获取中文的拼音字母
截取字符串方法总结(区分汉字、数字、字母)
Excel列号转换函数
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服