|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 ning84 于 2024-9-11 10:59 编辑
照猫画虎,结果不对,没有空格和数字
TherearecurrentlyeightparishesinMacau
澳门现有个堂区
代码如下
- Sub llll()
- Dim ii, oChar, English, Chinese
- Dim Str
- Str = "澳门现有8个堂区There are currently eight parishes in Macau."
- Dim EngDict As Scripting.Dictionary, ChiDict As Scripting.Dictionary
- Dim Dict As Scripting.Dictionary
- Set Dict = New Scripting.Dictionary
- For ii = 1 To Len(Str)
- oChar = Mid(Str, ii, 1)
- Debug.Print oChar
- If Asc(oChar) >= 65 And Asc(oChar) <= 122 Then
- English = English & oChar
- ElseIf Asc(oChar) >= -20319 And Asc(oChar) <= -3652 Then
- Chinese = Chinese & oChar
- End If
- Next ii
- Dict.Add "English", English
- Dict.Add "Chinese", Chinese
- Stop
- Debug.Print Dict("English") & vbCr; Dict("Chinese")
- End Sub
复制代码
遇到这种字符如何中文分离 Sé,St.等等。
"大堂区 Parish of Sé"
"望德堂区 Parish of St. Lazarus"
"风顺堂区 Parish of St. Lawrence"
"嘉模堂区 Parish of Our Lady of Carmel"
"圣方济各堂区 Parish of St. Francis Xavier"
"路氹填海区 Cotai Reclamation Area"
|
|