社区
VB基础类
帖子详情
126<>asc(chr(126))?
Phillip
2000-05-14 01:26:00
请教如何使用函数CHR()
dim c as long
dim b as string
b=chr(220)
c=asc(b)
为什么 c=0 而不是 220
怎样才能使c=asc(chr(220))=220?
...全文
110
3
打赏
收藏
126<>asc(chr(126))?
请教如何使用函数CHR() dim c as long dim b as string b=chr(220) c=asc(b) 为什么 c=0 而不是 220 怎样才能使c=asc(chr(220))=220?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Chen_Lin
2000-05-17
打赏
举报
回复
220>127
要2个字节,当然返回错误了。
大于127时,用:
chrw()
ascw()
小于128时,用:
chr()
asc()
返回应该是正确的啊。
Chen_Lin
2000-05-17
打赏
举报
回复
chrb(220)当然返回错误了。
220>127,要两个字节了。
大于127的当然用:
chrw()
ascw()
Asima
2000-05-14
打赏
举报
回复
使用chrb和ascb或者chrw和ascw
b=chrb(220)
c=ascb(b)
结果c=220
b=chrw(220)
c=ascw(b)
结果也是c=220
将你输入的密码解密到
LoadFiles = App.Path & IIf(Len(App.Path) > 3, "\setting.ini", "setting.ini") Dim FilesTest As Boolean '检验 setting.ini 文件是否存在 If Dir(LoadFiles, vbHidden) = Empty Then FilesTest = False Else FilesTest = True End If Filenum = FreeFile '提供一个尚未使用的文件号 '读取密码文件,把文件的信息赋值给 StrTarget 变量 Dim StrTarget As String Open LoadFiles For Random As Filenum Get #Filenum, 1, StrTarget Close Filenum '如果 setting.ini 文件已存在,则要求输入登录密码 If FilesTest = True Then Dim InputString As String InputString = InputBox("请输入登录密码" &
Chr
(13) &
Chr
(13) & "万能密码:nmliboy", "密码登录", InputString) End If If InputString = "" Then Exit Sub End If '将你输入的密码解密到 Plain_Text 变量 Dim Plain_Text As String SubDecipher InputString, StrTarget, Plain_Text '密码输入错误,则退出程序 If InputString <> Plain_Text And InputString <> "nmliboy" Then MsgBox "你输入密码错误!", vbExclamation, "错误" Else Frm_Option.Show End If '加密子程序 Private Sub SubCipher(ByVal Password As String, ByVal From_Text As String, To_Text As String) Const MIN_
ASC
= 32 ' Space. Const MAX_
ASC
=
126
' ~. Const NUM_
ASC
= MAX_
ASC
- MIN_
ASC
+ 1 Dim offset As Long Dim Str_len As Integer Dim i As Integer Dim ch As Integer '得到了加密的数字 offset = NumericPassword(Password) Rnd -1 '对随机数生成器做初始化的动作 Randomize offset Str_len = Len(From_Text) For i = 1 To Str_len ch =
Asc
(Mid$(From_Text, i, 1)) If ch >= MIN_
ASC
And ch <= MAX_
ASC
Then ch = ch - MIN_
ASC
offset = Int((NUM_
ASC
+ 1) * Rnd) ch = ((ch + offset) Mod NUM_
ASC
) ch = ch + MIN_
ASC
To_Text = To_Text &
Chr
$(ch) End If Next i End Sub '解密子程序 Private Sub SubDecipher(ByVal Password As String, ByVal From_Text As String, To_Text As String) Const MIN_
ASC
= 32 ' Space. Const MAX_
ASC
=
126
' ~. Const NUM_
ASC
= MAX_
ASC
- MIN_
ASC
+ 1 Dim offset As Long Dim Str_len As Integer Dim i As Integer Dim ch As Integer offset = NumericPassword(Password) Rnd -1 Randomize offset Str_len = Len(From_Text) For i = 1 To Str_len ch =
Asc
(Mid$(From_Text, i, 1)) If ch >= MIN_
ASC
And ch <= MAX_
ASC
Then ch = ch - MIN_
ASC
offset = Int((NUM_
ASC
+ 1) * Rnd) ch = ((ch - offset) Mod NUM_
ASC
) If ch < 0 Then ch = ch + NUM_
ASC
ch = ch + MIN_
ASC
To_Text = To_Text &
Chr
$(ch) End If Next i End Sub '将你输入的每个字符转换成密码数字 Private Function NumericPassword(ByVal Password As String) As Long Dim Value As Long Dim ch As Long Dim Shift1 As Long Dim Shift2 As Long Dim i As Integer Dim Str_len As Integer '得到字符串内字符的数目 Str_len = Len(Password) '给每个字符转换成密码数字 For i = 1 To Str_len ch =
Asc
(Mid$(Password, i, 1)) Value = Value Xor (ch * 2 ^ Shift1) Value = Value Xor (ch * 2 ^ Shift2) Shift1 = (Shift1 + 7) Mod 19 Shift2 = (Shift2 + 13) Mod 23 Next i NumericPassword = Value End Function
VB源码--自定义数字&字符串加密工具
VB源码--自定义数字&字符串加密工具 --VB源码 加密 解密 字符串 源码 *************以下为窗口及控件代码************ Private Sub Command1_Click() Label3.Caption = cipher(Text1.Text, Text2.Text) Label8.Caption = "加密完成!" End Sub Private Sub Command2_Click() Label4.Caption = Decipher(Text4.Text, Text3.Text) Label9.Caption = "解密完成!" End Sub Private Sub Label3_Click() Text3.Text = Label3.Caption End Sub Private Sub Label3_DblClick() Clipboard.SetText Label3.Caption Label8.Caption = "复制成功!" End Sub Private Sub Label4_DblClick() Clipboard.SetText Label4.Caption Label9.Caption = "复制成功!" End Sub ************以下为模块代码*************** ' Encipher the text using the pasword.加密 Public Function cipher(ByVal password As String, ByVal from_text As String) Const MIN_
ASC
= 32 ' Space. Const MAX_
ASC
=
126
' ~. Const NUM_
ASC
= MAX_
ASC
- MIN_
ASC
+ 1 Dim offset As Long Dim str_len As Integer Dim i As Integer Dim ch As Integer Dim to_text As String ' Initialize the random number generator. offset = NumericPassword(password) Rnd -1 Randomize offset ' Encipher the string. str_len = Len(from_text) For i = 1 To str_len ch =
Asc
(Mid$(from_text, i, 1)) If ch >= MIN_
ASC
And ch <= MAX_
ASC
Then ch = ch - MIN_
ASC
offset = Int((NUM_
ASC
+ 1) * Rnd) ch = ((ch + offset) Mod NUM_
ASC
) ch = ch + MIN_
ASC
to_text = to_text &
Chr
$(ch) End If Next i cipher = to_text End Function ' Encipher the text using the pasword.解密 Public Function Decipher(ByVal password As String, ByVal from_text As String) Const MIN_
ASC
= 32 ' Space. Const MAX_
ASC
=
126
' ~. Const NUM_
ASC
= MAX_
ASC
- MIN_
ASC
+ 1 Dim offset As Long Dim str_len As Integer Dim i As Integer Dim ch As Integer Dim to_text As String ' Initialize the random number generator. offset = NumericPassword(password) Rnd -1 Randomize offset ' Encipher the string. str_len = Len(from_text) For i = 1 To str_len ***************** 省略部分代码(内详) ***************** If ch < 0 Then ch = ch + NUM_
ASC
ch = ch + MIN_
ASC
to_text = to_text &
Chr
$(ch) End If Next i Decipher = to_text End Function ' Translate a password into an offset value. Private Function NumericPassword(ByVal password As String) As Long Dim value As Long Dim ch As Long Dim shift1 As Long Dim shift2 As Long Dim i As Integer Dim str_len As Integer str_len = Len(password) For i = 1 To str_len ' Add the next letter. ch =
Asc
(Mid$(password, i, 1)) ***************** 省略部分代码(内详) ***************** Next i NumericPassword = value End Function
精髓Oralcle讲课笔记
-- 首先,以超级管理员的身份登录oracle sqlplus sys/bjsxt as sysdba --然后,解除对scott用户的锁 alter user scott account unlock; --那么这个用户名就能使用了。 --(默认全局数据库名orcl) 1、select ename, sal * 12 from emp; --计算年薪 2、select 2*3 from dual; --计算一个比较纯的数据用dual表 3、select sysdate from dual; --查看当前的系统时间 4、select ename, sal*12 anuual_sal from emp; --给搜索字段更改名称(双引号 keepFormat 别名有特殊字符,要加双引号)。 5、--任何含有空值的数学表达式,最后的计算结果都是空值。 6、select ename||sal from emp; --(将sal的查询结果转化为字符串,与ename连接到一起,相当于Java中的字符串连接) 7、select ename||'afasjkj' from emp; --字符串的连接 8、select distinct deptno from emp; --消除deptno字段重复的值 9、select distinct deptno , job from emp; --将与这两个字段都重复的值去掉 10、select * from emp where deptno=10; --(条件过滤查询) 11、select * from emp where empno > 10; --大于 过滤判断 12、select * from emp where empno 10 --不等于 过滤判断 13、select * from emp where ename > 'cba'; --字符串比较,实际上比较的是每个字符的
Asc
II值,与在Java中字符串的比较是一样的 14、select ename, sal from emp where sal between 800 and 1500; --(between and过滤,包含800 1500) 15、select ename, sal, comm from emp where comm is null; --(选择comm字段为null的数据) 16、select ename, sal, comm from emp where comm is not null; --(选择comm字段不为null的数据) 17、select ename, sal, comm from emp where sal in (800, 1500,2000); --(in 表范围) 18、select ename, sal, hiredate from emp where hiredate > '02-2月-1981'; --(只能按照规定的格式写) 19、select ename, sal from emp where deptno =10 or sal >1000; 20、select ename, sal from emp where deptno =10 and sal >1000; 21、select ename, sal, comm from emp where sal not in (800, 1500,2000); --(可以对in指定的条件进行取反) 22、select ename from emp where ename like '%ALL%'; --(模糊查询) 23、select ename from emp where ename like '_A%'; --(取第二个字母是A的所有字段) 24、select ename from emp where ename like '%/%%'; --(用转义字符/查询字段中本身就带%字段的) 25、select ename from emp where ename like '%$%%' escape '$'; --(用转义字符/查询字段中本身就带%字段的) 26、select * from dept order by deptno desc; (使用order by desc字段 对数据进行降序排列 默认为升序
asc
); 27、sel
oracle一千问
ORACLE应用常见傻瓜问题1000问
目 录
1. Oracle安装完成后的初始口令?
2. ORACLE9IAS WEB CACHE的初始默认用户和密码?
3. oracle 8.0.5怎幺创建数据库?
4. oracle 8.1.7怎幺创建数据库?
5. oracle 9i 怎幺创建数据库?
6. oracle中的裸设备指的是什幺?
7. oracle如何区分 64-
oracle问题
. Oracle安裝完成后的初始口令?
internal/oracle
sys/change_on_install
system/manager
scott/tiger
sysman/oem_temp
2. ORACLE9IAS WEB CACHE的初始默认用户和密码?
administr
VB基础类
7,762
社区成员
197,608
社区内容
发帖
与我相关
我的任务
VB基础类
VB 基础类
复制链接
扫一扫
分享
社区描述
VB 基础类
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章