类型不匹配: 'clng'

来源:百度知道 编辑:UC知道 时间:2024/05/17 07:22:36
<%
class clsrsa
public privatekey
public publickey
public modulus
public function crypt(plngmessage,plngkey)
on error resume next
dim ilngmod,ilngresult,ilngindex
if plngkey mod 2=0 then
ilngresult=1
for ilngindex=1 to plngkey/2
ilngmod=(plngmessage^2)mod modulus
ilngresult=(ilngmod * ilngresult) mod modulus
if err then exit function
next
else
ilngresult=plngmessage
for ilngindex=1 to plngkey/2
ilngmod = (plngmessage^2)mod modulus
on error resume next
ilngresult=(ilngmod*ilngresult) mod modulus
if err then exit function
next
end if
crypt= ilngresult
end function
public function Encode(ByVal pStrMessage)
dim ilnginedx
dim ilngmaxindex
dim ibytascii
dim ilngencrypted
ilngmaxindex=len(pstrmessage)
if ilngmaxindex=0 then exit function
for ilngindex=1 to ilngmaxindex
ibytascii=asc(mid(pstrmessage,ilngindex,1))

CLng 函数
返回表达式,此表达式已被转换为 Long 子类型的 Variant。

CLng(expression)

expression 参数是任意有效的表达式。

说明
通常,您可以使用子类型数据转换函数书写代码,以显示某些操作的结果应当被表达为特定的数据类型,而非默认的数据类型。例如,在出现货币运算、单精度或双精度算术运算的情况下,使用 CInt 或 CLng 函数强制进行整数运算。

CLng 函数用于进行从其他数据类型到 Long 子类型的的国际公认的格式转换。例如,对十进制分隔符和千位分隔符的识别取决于系统的区域设置。

如果 expression 取值不在 Long子类型的允许范围内,则会出现错误。

下面的示例利用 CLng 函数把值转换为 Long:

Dim MyVal1, MyVal2, MyLong1, MyLong2
MyVal1 = 25427.45: MyVal2 = 25427.55 ' MyVal1, MyVal2 是双精度值。
MyLong1 = CLng(MyVal1) ' MyLong1 25427。
MyLong2 = CLng(MyVal2) ' MyLong2 包含 25428 。
注意 CLng 不同于 Fix 和 Int 函数删除小数部分, 而是采用四舍五入的方式。 当小数部分正好等于 0.5 时, CLng 函数总是将其四舍五入为最接近该数的偶数。如, 0.5 四舍五入为 0, 以及 1.5 四舍五入为 2 。