|
通过实例讲解来学习ASP中的函数(4) 语法: Left(string, length) 说明: <%
strTest = "This is a test!"
response.write Left(strTest, 3)
%>
结果: Thi
Len()
作用: 返回字符串的长度. 语法: Len(string varName) 说明: <%
strTest = "This is a test!"
response.write Len(strTest)
%>
结果: 15
LTrim()
作用: 去掉字符串左边的空格. 语法: LTrim(string) 说明: <%
strTest = " This is a test!"
response.write LTrim(strTest)
%>
结果: This is a test!
Mid()
作用: 返回特定长度的字符串(从start开始,长度为length). 语法: Mid(string, start [, length >) 说明: <%
strTest = "This is a test! Today is Monday."
response.write Mid(strTest, 17, 5)
%>
结果: Today
Minute()
作用: 返回时间的分钏. 语法: Minute(time) 说明: <%=Minute(#12:45:32 PM#)%>
结果: 45
Month()
作用: 返回日期. 语法: Month(date) 说明: date is any valid date expression. <%=Month(#08/04/99#)%>
结果: 8
MonthName()
作用: Returns a string identifying the specified month. 语法: MonthName(month, [, Abb >) 说明: 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. <%=MonthName(Month(#08/04/99#))%>
结果: August
Now()
作用: Returns the current system date and time.返回当前系统时间 语法: Now() 说明: None <%=Now%>
结果: 8/4/99 9:30:16 AM
Replace()
作用: Returns a string in which a specified sub-string has been replaced with another substring a specified number of times. 语法: Replace(strToBeSearched, strSearchFor, strReplaceWith [, start [, count [, compare >>>) 说明: 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.
|