ASP的函數詳解-2

來源:互聯網
上載者:User
函數|詳解 LCase()
  FUNCTION: 返回字串的小寫形式
  SYNTAX: Lcase(string)
  ARGUMENTS: string is any valid string expression.
  EXAMPLE: <%
  strTest = "This is a test!"
  response.write LCase(strTest)
  %>
  RESULT: this is a test!

Left()
  FUNCTION: 返回字串左邊第length個字元以前的字元(含第length個字元).
  SYNTAX: Left(string, length)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "This is a test!"
  response.write Left(strTest, 3)
  %>
  RESULT: Thi

Len()
  FUNCTION: 返回字串的長度.
  SYNTAX: Len(string | varName)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "This is a test!"
  response.write Len(strTest)
  %>
  RESULT: 15

LTrim()
  FUNCTION: 去掉字串左邊的空格.
  SYNTAX: LTrim(string)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = " This is a test!"
  response.write LTrim(strTest)
  %>
  RESULT: This is a test!

Mid()
  FUNCTION: 返回特定長度的字串(從start開始,長度為length).
  SYNTAX: Mid(string, start [, length>)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "This is a test! Today is Monday."
  response.write Mid(strTest, 17, 5)
  %>
  RESULT: Today

Minute()
  FUNCTION: 返回時間的分釧.
  SYNTAX: Minute(time)
  ARGUMENTS:
  EXAMPLE: <%=Minute(#12:45:32 PM#)%>
  RESULT: 45

Month()
  FUNCTION: 返回日期.
  SYNTAX: Month(date)
  ARGUMENTS: date is any valid date expression.
  EXAMPLE: <%=Month(#08/04/99#)%>
  RESULT: 8

MonthName()
  FUNCTION: Returns a string identifying the specified month.
  SYNTAX: MonthName(month, [, Abb>)
  ARGUMENTS: month is the numeric representation for a given month; Abb (optional) is a boolean value used to display month abbreviation. True will display the abbreviated month name and False (default) will not show the abbreviation.
  EXAMPLE: <%=MonthName(Month(#08/04/99#))%>
  RESULT: August

Now()
  FUNCTION: Returns the current system date and time.
  SYNTAX: Now()
  ARGUMENTS: None
  EXAMPLE: <%=Now%>
  RESULT: 8/4/99 9:30:16 AM

Replace()
  FUNCTION: Returns a string in which a specified sub-string has been replaced with another substring a specified number of times.
  SYNTAX: Replace(strToBeSearched, strSearchFor, strReplaceWith [, start [, count [, compare>>>)
  ARGUMENTS: strToBeSearched is a string expression containing a sub-string to be replaced; strSearchFor is the string expression to search for within strToBeSearched; 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.
  EXAMPLE: <%
  strTest = "This is an apple!"
  response.write Replace(strTest, "apple", "orange")
  %>
  RESULT: This is an orange!

Right()
  FUNCTION: 返回字串右邊第length個字元以前的字元(含第length個字元).
  SYNTAX: Right(string, length)
  ARGUMENTS: .
  EXAMPLE: <%
  strTest = "This is an test!"
  response.write Right(strTest, 3)
  %>
  RESULT: st!

Rnd()
  FUNCTION: 產生一個隨機數.
  SYNTAX: Rnd [ (number) >
  ARGUMENTS:
  EXAMPLE: <%
  Randomize()
  response.write RND()
  %>
  RESULT: 任何一個在0 到 1 之間的數

Round()
  FUNCTION: 返回按指定位元進行四捨五入的數值.
  SYNTAX: Round(expression [, numRight>)
  ARGUMENTS: numRight數字表明小數點右邊有多少位進行四捨五入。如果省略,則 Round 函數返回整數.
  EXAMPLE: <%
  i = 32.45678
  response.write Round(i)
  %>
  RESULT: 32

Rtrim()
  FUNCTION: 去掉字串右邊的字串.
  SYNTAX: Rtrim(string)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "This is a test!! "
  response.write RTrim(strTest)
  %>
  RESULT: This is a test!!

Second()
  FUNCTION: 返回秒.
  SYNTAX: Second(time)
  ARGUMENTS: .
  EXAMPLE: <%=Second(#12:34:28 PM#)%>
  RESULT: 28

StrReverse()
  FUNCTION: 反排一字串
  SYNTAX: StrReverse(string)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "This is a test!!"
  response.write StrReverse(strTest)
  %>
  RESULT: !!tset a si sihT

Time()
  FUNCTION: 返回系統時間.
  SYNTAX: Time()
  ARGUMENTS: .
  EXAMPLE: <%=Time%>
  RESULT: 9:58:28 AM

Trim()
  FUNCTION: 去掉字串左右的空格.
  SYNTAX: Trim(string)
  ARGUMENTS: string is any valid string expression.
  EXAMPLE: <%
  strTest = " This is a test!! "
  response.write Trim(strTest)
  %>
  RESULT: This is a test!!

UBound()
  FUNCTION: 返回指定數組維數的最大可用下標.
  SYNTAX: Ubound(arrayname [, dimension>)
  ARGUMENTS: dimension (optional) 指定返回哪一維上界的整數。1 表示第一維,2 表示第二維,以此類推。如果省略 dimension 參數,則預設值為 1.
  EXAMPLE: <%
  i = Array("Monday","Tuesday","Wednesday")
  response.write UBound(i)
  %>
  RESULT: 2

UCase()
  FUNCTION: 返回字串的大寫形式.
  SYNTAX: UCase(string)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "This is a test!!"
  response.write UCase(strTest)
  %>
  RESULT: THIS IS A TEST!!

VarType()
  FUNCTION: 返回指示變數子類型的值
  SYNTAX: VarType(varName)
  ARGUMENTS:
  EXAMPLE: <%
  i = 3
  response.write varType(i)
  %>
  RESULT: 2(數字)詳見"asp常數"

WeekDay()
  FUNCTION: 返回在一周的第幾天.
  SYNTAX: WeekDay(date [, firstdayofweek>)
  ARGUMENTS: .
  EXAMPLE: <%
  d = #8/4/99#
  response.write Weekday(d)
  %>
  RESULT: 4(星期三)

WeekDayName()
  FUNCTION: 返回一周第幾天的名字.
  SYNTAX: WeekDayName(weekday [, Abb [, firstdayofweek>>)
  ARGUMENTS: Abb可選。Boolean 值,指明是否縮寫表示星期各天的名稱。如果省略, 預設值為 False,即不縮寫星期各天的名稱.firstdayofweek指明星期第一天的數值
  EXAMPLE: <%
  d = #8/4/99#
  response.write WeekdayName(Weekday(d))
  %>
  RESULT: Wednesday

Year()
  FUNCTION: 返回當前的年份.
  SYNTAX: Year(date)
  ARGUMENTS:
  EXAMPLE: <%=Year(#8/4/99#)%>
  RESULT: 1999

相關文章

Cloud Intelligence Leading the Digital Future

Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

Register Now >

Starter Package

SSD Cloud server and data transfer for only $2.50 a month

Get Started >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。