|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
不考虑多音字,希望高手门再提速,
在按钮七里是我自已弄出来的最快速度了
我的一点经验
用IF比弄成常量更快
先用ASC转码更快
用Mid$来替换更快
本想用REPLACE同时处理相同汉字,但速度更慢,可能是REPLACE需要循环每个字符
汉字首字母对比.rar
(75.47 KB, 下载次数: 26)
目前最快的代码如下:
Function hzpy(ByVal strParmeter As String) As String
Dim i As Long, lent As Long
lent = Len(strParmeter)
hzpy = strParmeter
For i = 1 To lent
intTmp = Asc(Mid$(strParmeter, i, 1))
If intTmp < -20283 Then ' 芭
Mid$(hzpy, i, 1) = "A"
ElseIf intTmp < -19775 Then ' 擦
Mid$(hzpy, i, 1) = "B"
ElseIf intTmp < -19218 Then ' 搭
Mid$(hzpy, i, 1) = "C"
ElseIf intTmp < -18710 Then ' 蛾
Mid$(hzpy, i, 1) = "D"
ElseIf intTmp < -18526 Then ' 发
Mid$(hzpy, i, 1) = "E"
ElseIf intTmp < -18239 Then ' 噶
Mid$(hzpy, i, 1) = "F"
ElseIf intTmp < -17922 Then ' 哈
Mid$(hzpy, i, 1) = "G"
ElseIf intTmp < -17417 Then ' 击
Mid$(hzpy, i, 1) = "H"
ElseIf intTmp < -16474 Then ' 喀
Mid$(hzpy, i, 1) = "J"
ElseIf intTmp < -16212 Then ' 垃
Mid$(hzpy, i, 1) = "K"
ElseIf intTmp < -15640 Then ' 妈
Mid$(hzpy, i, 1) = "L"
ElseIf intTmp < -15165 Then ' 拿
Mid$(hzpy, i, 1) = "M"
ElseIf intTmp < -14922 Then ' 哦
Mid$(hzpy, i, 1) = "N"
ElseIf intTmp < -14914 Then ' 啪
Mid$(hzpy, i, 1) = "O"
ElseIf intTmp < -14630 Then ' 期
Mid$(hzpy, i, 1) = "P"
ElseIf intTmp < -14149 Then ' 然
Mid$(hzpy, i, 1) = "Q"
ElseIf intTmp < -14090 Then ' 撒
Mid$(hzpy, i, 1) = "R"
ElseIf intTmp < -13318 Then ' 塌
Mid$(hzpy, i, 1) = "S"
ElseIf intTmp < -12838 Then ' 挖
Mid$(hzpy, i, 1) = "T"
ElseIf intTmp < -12556 Then ' 昔
Mid$(hzpy, i, 1) = "W"
ElseIf intTmp < -11847 Then ' 压
Mid$(hzpy, i, 1) = "X"
ElseIf intTmp < -11055 Then ' 匝
Mid$(hzpy, i, 1) = "Y"
ElseIf intTmp < -10246 Then ' 座
Mid$(hzpy, i, 1) = "Z"
End If
Next
End Function
|
评分
-
1
查看全部评分
-
|