标题:变量s中的0-9为什么没有被替换,如何改?
取消只看楼主
yuma
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:银河系
等 级:贵宾
威 望:33
帖 子:1883
专家分:2904
注 册:2009-12-22
结帖率:89.13%
 问题点数:0 回复次数:1 
变量s中的0-9为什么没有被替换,如何改?
变量s中的0-9为什么没有被替换,如何改?

程序代码:
Private Sub Form_Load()
Dim s As String
s = "73203d2022d6d0bbaac"
For i = 1 To Len(s)
a = Mid(s, i, 1)
a = Replace(a, "0", "f")
a = Replace(a, "1", "e")
a = Replace(a, "2", "d")
a = Replace(a, "3", "c")
a = Replace(a, "4", "b")
a = Replace(a, "5", "a")
a = Replace(a, "6", "9")
a = Replace(a, "7", "8")
a = Replace(a, "8", "7")
a = Replace(a, "9", "6")
a = Replace(a, "a", "5")
a = Replace(a, "b", "4")
a = Replace(a, "c", "3")
a = Replace(a, "d", "2")
a = Replace(a, "e", "1")
a = Replace(a, "f", "0")
b = b & a
Next
Debug.Print b
End Sub
搜索更多相关主题的帖子: 变量 替换 Replace Sub Next 
2021-08-26 21:20
yuma
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:银河系
等 级:贵宾
威 望:33
帖 子:1883
专家分:2904
注 册:2009-12-22
得分:0 
s = "73203d2022d6d0bbaac"
For i = 1 To Len(s)
a = Mid(s, i, 1)
If a = "0" Then b = "f"
If a = "1" Then b = "e"
If a = "2" Then b = "d"
If a = "3" Then b = "c"
If a = "4" Then b = "b"
If a = "5" Then b = "a"
If a = "6" Then b = "9"
If a = "7" Then b = "8"
If a = "8" Then b = "7"
If a = "9" Then b = "6"
If a = "a" Then b = "5"
If a = "b" Then b = "4"
If a = "c" Then b = "3"
If a = "d" Then b = "2"
If a = "e" Then b = "1"
If a = "f" Then b = "0"
c = c & b
Next
MsgBox c

[此贴子已经被作者于2021-11-29 13:43编辑过]


心生万象,万象皆程序!
本人计算机知识网:http://bbs.为防伸手党,本站已停止会员注册。
2021-08-27 06:16



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-506664-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.199086 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved