设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

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

[模块/函数] 从罗斯文改造而来的拼音助记码函数

[复制链接]
跳转到指定楼层
1#
发表于 2008-12-20 16:06:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
罗斯文中原为:
Public Function PinYin(Tstr As String) As Long
Dim I As Long

I = Asc(Tstr)

If I >= Asc("啊") And I < Asc("芭") Then PinYin = 1

If I >= Asc("芭") And I < Asc("擦") Then PinYin = 2

If I >= Asc("擦") And I < Asc("搭") Then PinYin = 3

If I >= Asc("搭") And I < Asc("蛾") Then PinYin = 4

If I >= Asc("蛾") And I < Asc("发") Then PinYin = 5

If I >= Asc("发") And I < Asc("噶") Then PinYin = 6

If I >= Asc("噶") And I < Asc("哈") Then PinYin = 7

If I >= Asc("哈") And I < Asc("击") Then PinYin = 8

If I >= Asc("击") And I < Asc("喀") Then PinYin = 9

If I >= Asc("喀") And I < Asc("垃") Then PinYin = 10

If I >= Asc("垃") And I < Asc("妈") Then PinYin = 11

If I >= Asc("妈") And I < Asc("拿") Then PinYin = 12

If I >= Asc("拿") And I < Asc("哦") Then PinYin = 13

If I >= Asc("哦") And I < Asc("啪") Then PinYin = 14

If I >= Asc("啪") And I < Asc("欺") Then PinYin = 15

If I >= Asc("欺") And I < Asc("然") Then PinYin = 16

If I >= Asc("然") And I < Asc("撒") Then PinYin = 17

If I >= Asc("撒") And I < Asc("塌") Then PinYin = 18

If I >= Asc("塌") And I < Asc("挖") Then PinYin = 19

If I >= Asc("挖") And I < Asc("昔") Then PinYin = 20

If I >= Asc("昔") And I < Asc("压") Then PinYin = 21

If I >= Asc("压") And I < Asc("匝") Then PinYin = 22

If I >= Asc("匝") And I <= Asc("座") Then PinYin = 23

End Function

改造一下,可以成为拼音助记码函数:

Public Function PinYin(Tstr As String) As String
Dim I As String

I = Asc(Tstr)

If I >= Asc("啊") And I < Asc("芭") Then PinYin = "a"

If I >= Asc("芭") And I < Asc("擦") Then PinYin = "b"

If I >= Asc("擦") And I < Asc("搭") Then PinYin = "c"

If I >= Asc("搭") And I < Asc("蛾") Then PinYin = "d"

If I >= Asc("蛾") And I < Asc("发") Then PinYin = "e"

If I >= Asc("发") And I < Asc("噶") Then PinYin = "f"

If I >= Asc("噶") And I < Asc("哈") Then PinYin = "g"

If I >= Asc("哈") And I < Asc("击") Then PinYin = "h"

If I >= Asc("击") And I < Asc("喀") Then PinYin = "j"

If I >= Asc("喀") And I < Asc("垃") Then PinYin = "k"

If I >= Asc("垃") And I < Asc("妈") Then PinYin = "l"

If I >= Asc("妈") And I < Asc("拿") Then PinYin = "m"

If I >= Asc("拿") And I < Asc("哦") Then PinYin = "n"

If I >= Asc("哦") And I < Asc("啪") Then PinYin = "o"

If I >= Asc("啪") And I < Asc("欺") Then PinYin = "p"

If I >= Asc("欺") And I < Asc("然") Then PinYin = "q"

If I >= Asc("然") And I < Asc("撒") Then PinYin = "r"

If I >= Asc("撒") And I < Asc("塌") Then PinYin = "s"

If I >= Asc("塌") And I < Asc("挖") Then PinYin = "t"

If I >= Asc("挖") And I < Asc("昔") Then PinYin = "w"

If I >= Asc("昔") And I < Asc("压") Then PinYin = "x"

If I >= Asc("压") And I < Asc("匝") Then PinYin = "y"

If I >= Asc("匝") And I <= Asc("座") Then PinYin = "z"

If Not (I >= Asc("芭") And I <= Asc("座")) Then PinYin = Tstr

py_Exit:
    Exit Function
py_Err:
    PinYin = ""
    Resume py_Exit

End Function

(算法函数_API_系统-相关文章技巧链接):
Access从罗斯文数据库中修改的拼音助记码函数

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享分享 分享淘帖 订阅订阅
2#
发表于 2008-12-20 16:25:32 | 只看该作者
3#
发表于 2008-12-20 16:52:59 | 只看该作者
用ASC不行,好多字出不来,特别是药品化学名。
4#
 楼主| 发表于 2008-12-20 17:09:01 | 只看该作者

回复 2# 的帖子

哦,没注意有了。呵呵
5#
 楼主| 发表于 2008-12-20 17:12:47 | 只看该作者
是三氯氰胺之类吗?我想应该也行吧。
6#
发表于 2008-12-20 19:51:13 | 只看该作者
微软这个有bug
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-19 17:45 , Processed in 0.086117 second(s), 31 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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