加载中...

通过实例讲解来学习ASP中的函数

作者:佚名    文章来源:无忧源码收集整理    点击数:    更新时间:2007-8-11
; strReplaceWith is the string expression to replace sub-string strSearchFor; start (optional) is the numeric character position to begin search; count (optional) is a value indicating the comparision constant.  
<%
strTest = "This is an apple!"
response.write Replace(strTest, "apple", "orange")
%>

结果: This is an orange!

Right()

作用: 返回字符串右边第length个字符以前的字符(含第length个字符).
   语法: Right(string, length)
  说明: .

<%  strTest =   "This is an test!"  response.write Right(strTest, 3)  %>  

结果: st!

Rnd()

作用: 产生一个随机数.
   语法: Rnd [ (number) >
  说明:

<%  Randomize()  response.write RND()  %>  

结果: 任何一个在0 到 1 之间的数

Round()

作用: 返回按指定位数进行四舍五入的数值.
   语法: Round(expression [, numRight >)
  说明: numRight数字表明小数点右边有多少位进行四舍五入。如果省略,则 Round 函数返回整数.

<%  i = 32.45678  response.write Round(i)  %>  

结果: 32

Rtrim()

作用: 去掉字符串右边的空格字符串.
   语法: Rtrim(string)
  说明:

<%  strTest =   "This is a test!! "  response.write RTrim(strTest)  %>  

 结果: This is a test!!

Second()

作用: 返回秒.
   语法: Second(time)
  说明:

<%=Second(#12:34:28 PM#)%>

结果: 28

StrReverse()

作用: 反排一字符串
   语法: StrReverse(string)
  说明:

<%  strTest =   "This is a test!!"  response.write StrReverse(strTest)  %>
  结果: !!tset a si sihT

Time()

作用: 返回系统时间.
   语法: Time()
  说明: .

<%=Time%>

结果: 9:58:28 AM

Trim()

作用: 去掉字符串左右的空格.
   语法: Trim(string)
  说明: string is any valid string expression.

<%  strTest =   " This is a test!! "  response.write Trim(strTest)  %>  

 结果: This is a test!!

UBound()

作用: 返回指定数组维数的最大可用下标.
   语法: Ubound(arrayname [, dimension >)
  说明: dimension (optional) 指定返回哪一维上界的整数。1 表示第一维,2 表示第二维

上一页  [1] [2] [3] [4] [5] [6] 下一页

  • 上一篇文章: 没有了

文章评论

只显示最新5条。评论内容只代表网友观点,与本站立场无关!查看完整内容

源码下载 ASP源码网 源码之家 网站源码 论坛源码

© CopyRight 2006-2007, 5UYM.COM, Inc. All Rights Reserved 京ICP备07028154号