[转载]罗斯文数据库中提供的一段代码

本文介绍了一个用于将汉字转换为其对应拼音级别的VB函数。该函数通过比较字符的ASCII值来确定其拼音首字母所在的范围,并返回相应的拼音级别编号。

[ 此文章内容主要转于Microsoft Access 所提供的示例Northwind数据库]

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 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

.Net学习

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值