计算机等级考试二级VB常用算法(10):字符处理
1.算法描述
1)加密解密
最简单的加密方法是:给每个字母加一个序数,比如5,此时:
“A”→“F”,“B”→“G”,“B”→
代码如下:
option explicit
private subcommand 1 _ click()
dimstrinput $,code $,record $,c as string * 1
米蒂%,长度%,iAsc %[]text
length = Len(Trim(strInput))
Code = " "
For I = 1 To length
c = mid(strInput,I,1)
Select Case c
Case " A " To " Z "
iAsc = Asc(c)+5
If iAsc > Asc(" Z ")则iAsc = iAsc-26
Code = Code & Chr(iAsc)[/brtext = Code
End Sub
Private Sub command 3 _ Click()
text 1。Text = ""
Text2。Text = ""
Text3。Text = ""
Text1。SetFocus
End Sub
0条评论