标题: 【求助】实现拼音首字母查询出现了点问题 [打印本页] 作者: yangruihao 时间: 2011-11-1 15:08 标题: 【求助】实现拼音首字母查询出现了点问题 [attach]47179[/attach]
要实现图片中的查询..
里面有一模块是拼音首字母函数的
Public Function PinYin(Tstr As String) As String
Dim I As Long
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"
End Function
Function Getpinyin(str As String) As String
Dim I As Long
For I = 1 To Len(str)
Getpinyin = Getpinyin & PinYin(Mid(str, I, 1))
Next I