网络编程
位置:首页>> 网络编程>> Asp编程>> 38个Asp内置函数介绍(2)

38个Asp内置函数介绍(2)

作者:cnbruce 来源:cnbruce博客 发布时间:2008-11-27 16:25:00 

标签:函数,日期,时间,asp

11.函数Isnumeric() 

功能:返回一个布尔值,判断变量是否为数字变量,或者是可以转换成数字的其它变量. 
格式:isnumeric(expression) 
参数:expression 是任意的变量. 
例子: 

<% 
i="234" 
response.write isnumeric(i) 
%> 

结果: true. 

12.函数Isobject() 

功能:返回一个布尔值,判断变量是否为对象的变量, 
格式: isobject(expression) 
参数: expression 是任意的变量. 
例子: 

<% 
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 len(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是时间变量 

例子

<% =minute(#12:23:34#) %> 

结果:23 

20.函数month() 

功能:返回一数值, 表示月份 
格式:month(time) 

参数:time是日期变量 

例子

<% =month(#08/09/99) %> 

结果:9 

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com