设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1141|回复: 3
打印 上一主题 下一主题

[与其它组件] 既然能对中文以拼音排序,有什么办法提取这个拼音字母?

[复制链接]
跳转到指定楼层
1#
发表于 2003-5-30 01:00:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
对某一中文字段排序后,他是按每一个字的中文字母的拼音排序的.我能取得这个字母吗?
例:"我" 这个字,我用什么方法,可知他的第一个拼音是"W",用VBA也可以如能实现也可以!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享分享 分享淘帖 订阅订阅
2#
发表于 2003-5-31 05:03:00 | 只看该作者
Public Function HZ2PY(Tstr As String, Optional onlyFirst As Boolean) As String
    On Error GoTo err

    If onlyFirst Then Tstr = Left(Tstr, 1)

    Dim intTstrLong As Integer
    Dim strPY As String
    Dim i As Long, p As Integer
    For intTstrLong = 1 To Len(Tstr)

        i = Asc(Mid(Tstr, intTstrLong, 1))
        If i <= Asc("啊") Or i >= Asc("座") Then
            strPY = strPY & Mid(Tstr, intTstrLong, 1)

        Else

            If i >= Asc("啊") And i < Asc("芭") Then p = 65
            If i >= Asc("芭") And i < Asc("擦") Then p = 66
            If i >= Asc("擦") And i < Asc("搭") Then p = 67
            If i >= Asc("搭") And i < Asc("蛾") Then p = 68
            If i >= Asc("蛾") And i < Asc("发") Then p = 69
            If i >= Asc("发") And i < Asc("噶") Then p = 70
            If i >= Asc("噶") And i < Asc("哈") Then p = 71
            If i >= Asc("哈") And i < Asc("击") Then p = 72
            If i >= Asc("击") And i < Asc("喀") Then p = 74
            If i >= Asc("喀") And i < Asc("垃") Then p = 75
            If i >= Asc("垃") And i < Asc("妈") Then p = 76
            If i >= Asc("妈") And i < Asc("拿") Then p = 77
            If i >= Asc("拿") And i < Asc("哦") Then p = 78
            If i >= Asc("哦") And i < Asc("啪") Then p = 79
            If i >= Asc("啪") And i < Asc("欺") Then p = 80
            If i >= Asc("欺") And i < Asc("然") Then p = 81
            If i >= Asc("然") And i < Asc("撒") Then p = 82
            If i >= Asc("撒") And i < Asc("塌") Then p = 83
            If i >= Asc("塌") And i < Asc("挖") Then p = 84
            If i >= Asc("挖") And i < Asc("昔") Then p = 87
            If i >= Asc("昔") And i < Asc("压") Then p = 88
            If i >= Asc("压") And i < Asc("匝") Then p = 89
            If i >= Asc("匝") And i <= Asc("座") Then p = 90
            strPY = strPY & Chr(p)

        End If

    Next intTstrLong

    HZ2PY = strPY

    Exit Function

err:

    MsgBox err.Number & err.Description

End Function
3#
发表于 2003-5-31 05:26:00 | 只看该作者
罗斯文示例数据库里面有相关的函数,你只要改一下就可以了
4#
 楼主| 发表于 2003-6-2 18:10:00 | 只看该作者

万分感谢

谢谢了.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-10-5 19:19 , Processed in 0.093019 second(s), 28 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表