Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1717051
  • 博文数量: 171
  • 博客积分: 11553
  • 博客等级: 上将
  • 技术积分: 3986
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-25 20:28
文章分类

全部博文(171)

文章存档

2012年(2)

2011年(70)

2010年(9)

2009年(14)

2008年(76)

分类:

2008-05-10 19:14:04

文件:HelpFunctions.zip
大小:0KB
下载:下载

'1.Eval的用法
Dim intA,intB
intA = 10
intB = 20

Wscript.echo (intA = intB)
Wscript.echo Eval( intA = intB )
'2.数学函数
'绝对值
Wscript.echo Abs( -120 )
'Cos,Sin,Tan,
'求随机数
For i = 0 to 10
    Wscript.echo Rnd
Next
'求整数
sgnPI = 3.1415
Wscript.echo CInt( sgnPI )
Wscript.echo Fix( sgnPI )

'求平方根
Wscript.echo Sqr( 16 )

'3.字符串操作函数
'去除空格函数
Dim strLine
strLine = " Spacebar string "
'去除左右空格
Wscript.echo Trim( strLine )
'去除左空格
Wscript.echo LTrim( strLine )
'去除右空格
Wscript.echo RTrim( strLine )

strLine = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
'去左边的5个字符
Wscript.echo Left( strLine, 5 )
'取右边的5个字符
Wscript.echo Right( strLine,5 )
'从制定的位置去制定长度的字符
Wscript.echo Mid( strLine, 5,5 )
'计算字符串的长度
Wscript.echo Len( strLine )
'字符串替换
Wscript.echo Replace( strLine, "AB","BA" )
'比较两个字符创
Wscript.echo StrComp("abc","ABC")
Wscript.echo StrComp("abc","abc")


'对字符串进行分割
strLine = "Hello VBScript,I Love it"
strArray = Split( strLine )
For i = 0 to UBound( strArray )
    Wscript.echo strArray( i )
Next

'4.时间函数
'获取当前时间
Wscript.echo Now
Wscript.echo Year( Now )
Wscript.echo Month( Now )
Wscript.echo Day( Now )
Wscript.echo Hour( Now )
Wscript.echo Minute( Now )
Wscript.echo Second( Now )

'5.进制转化
intDec = 16
Wscript.echo intDec
'十六进制
Wscript.echo Hex( intDec )
'八进制
Wscript.echo Oct( intDec )

阅读(1057) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~