微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > wincc中使用vbs常用函数

wincc中使用vbs常用函数

时间:06-23 来源:互联网 点击:

numeric(expression_r)

参数:expression_r 是任意的变量.

例子:

%

i=“234”

response.write isnumeric(i)

%>

结果: true.

12.函数Isobject()

功能:返回一个布尔值,判断变量是否为对象的变量,

格式: isobject(expression_r)

参数: expression_r 是任意的变量.

例子:

%

set con =server.creatobject(“adodb.connection”)

response.write isobject(con)

%>

结果: true

13.函数:Lbound()

功能:返回一个数组的下界.

格式:Lbound(arrayname[,dimension])

参数:arrayname 是数组变量,dimension 是任意项

例子:

%

i = array(“1”,”2”,”3”)

response.write lbound(i)

%>

结果:0

14.函数Lcase()

功能:将一字符类型变量的字符全部变换小写字符.

格式:Lcase(string)

参数:string是字符串变量

例子:

%

str=“THIS is Lcase!”

response.write Lcase(str)

%>

结果:this is lcase!15.函数left()

功能:截取一个字符串的前部分;

格式:left(string,length)

参数:string字符串,length截取的长度.

例子: % =left(“this is a test!”,6) %>

结果:this i

16.函数len()

功能:返回字符串长度或者变量的字节长度

格式:len(string *varname)

参数:string字符串;varname任意的变量名称

例子:

%

strtest=“this is a test!”

response.write left(strtest)

%>

结果:15

17.函数ltrim()

功能:去掉字符串前的空格.

格式:ltrim(string)

参数:string 字符串.

例子: % =ltrim (“ this is a test!”)

结果:this is a test!

18.函数Mid()

功能:从字符串中截取字符串.

格式:mid(string,start [,length])

参数:string字符串,start截取的起点,length要截取的长度.

例子:

%

strtest=“this is a test, Today is Monday!”

response.write mid(strtest,17,5)

%>

结果:Today

19.函数minute()

功能:返回一数值, 表示分钟

格式:minute(time)

参数: time是时间变量

例子lt;% =minute(#12:23:34#) %>

结果:23

20.函数month()

功能:返回一数值, 表示月份

格式:month(time)

参数:time是日期变量

例子% =month(#08/09/99) %>

结果:9

[color=#1E90FF]21.函数monthname()[/color]

功能:返回月份的字符串(名称).

格式:Monthname(date [,abb])

参数: date是日期变量,abb=true时 则月份的缩写,

例子:

% =monthname(#4/5/99#) %>

结果:April

22.函数Now()

功能:返回系统的当前时间和日期.

格式:now()

参数:无

例子:

% =now() %>

结果: 05/10/00 8:45:32 pm

25.函数rnd()

功能:返回一个随机数值

格式:rnd[(number)]

参数:number是任意数值.

例子:

%

randomize()

response.write rnd()

%>

结果:0/1数值之一,无randomize(), 则不能产生随机数.

26.函数round()

功能:完整数值

格式:round(expression_r[,numright])

参数:expression_r数字表达式;numright任意选项.

例子:

%

i=12.33654

response.write round(i)

%>

结果: 12

27.函数rtrim()

功能:去掉字符串后的空格.

格式:rtrim(string)

参数:string 是字符串

例子:

%

response.write rtrim(“this is a test! ”)

%>

结果:this is a test!

23.函数:replace()

功能:在字符串中查找,替代指定的字符串.

格式:replace(strtobesearched,strsearchfor,strreplacewith [,start[,count[,compare]]])

参数:strtobesearched是字符串; strsearchfor是被查找的子字符串;strreplacewith 是用来替代的子字符串.start,count,compare 是任意选项.

例子:

%

strtest=“this is an apple.”

response.write replace(strtest,”apple”,”orange”)

%>

结果:this is an orange.

24.函数right()

功能:截取一个字符串的后部分

格式:right(string,length)

参数:string字符串,length截取的长度.

例子:

%

strtest=“this is a test!”

response.write right(strtest,3)

%>

结果:st!28.函数second()

功能:返回一个整数值.

格式:second(time)

参数:time是一个有效的时间表达式;

例子lt;% =second(# 12:28:30#) %>

结果:30

29.函数strReverse()

功能:返回与原字符串排列逆向的字符串.

格式:strreverse(string)

参数:string是字符串

例子% =strreverse(“this is a test!”)

结果:!tset a si siht

30.函数time()

功能:返回当前系统的时间值.

格式:time()

参数:无

结果:9:58:28 Am

31.函数trim()

功能:删去字符串前,后的空格.

格式:trim(string)

参数:string 字符串.

例子:

%

strtest=“ this is a test! ”

response.write trim(strtest)

%>

结果:this is a test!

32.函数UBound()

功能:返回一个数组的上界.

格式:Ubound(expression_r [,dimension])

参数:expression_r是数组表

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top