VB问题,高手进,在线等,急急急!!!

[复制链接]
查看11 | 回复1 | 2007-11-30 19:35:15 | 显示全部楼层 |阅读模式
'添加窗体Form1,文本框Text1,Text2,按钮Command1,然后添加如下代码:PrivateSubCommand1_Click()Text2.Text=strToPassword(Text1.Text,-2)'左移两位EndSub'函数名:strToPassword'功能:按要求将字符转化为“密码”'参数:strSource为要处理的字符,intMove为将字符中的每个字符移动多少位'返回值:strToPassword处理好的字符串PrivateFunctionstrToPassword(strSourceAsString,intMoveAsInteger)Dimi,intAscTemp,intAscTempMoveAsIntegerDimstrTempAsStringFori=1ToLen(strSource)strTemp=Mid(strSource,i,1)intAscTemp=Asc(strTemp)intAscTempMove=intAscTemp+intMoveIfstrTempLike"[a-zA-Z]"ThenIfintAscTemp>=97Then'是小写字母IfintAscTempMove122Then'超出尾端的情况strTemp=Chr(intAscTempMove-122+97-1)ElsestrTemp=Chr(intAscTempMove)EndIfElseIfintAscTemp>=65Then'是大写字母IfintAscTempMove90Then'超出尾端的情况strTemp=Chr(intAscTempMove-90+65-1)ElsestrTemp=Chr(intAscTempMove)EndIfEndIfEndIfstrToPassword=strToPassword&strTempNextEndFunction
回复

使用道具 举报

千问 | 2007-11-30 19:35:15 | 显示全部楼层
.........这么简单,自己看书去.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行