ASP下经常用的字符串等函数参考资料(6)
RESULT: 45.325
FormatPercent()
FUNCTION: 返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以
100 )。 (%)
SYNTAX: FormatPercent(Expression [, Digit ][, LeadingDigit ][, Paren ][,
GroupDigit]]]])
ARGUMENTS: 同上.
EXAMPLE: <%=FormatPercent(0.45267, 3)%>
RESULT: 45.267%
Hour()
FUNCTION: 以24时返回小时数.
SYNTAX: Hour(time)
ARGUMENTS:
EXAMPLE: <%=Hour(#4:45:34 PM#)%>
RESULT: 16
(Hour has been converted to 24-hour system)
Instr()
FUNCTION: 返回字符或字符串在另一个字符串中第一次出现的位置.
SYNTAX: Instr([start, ] strToBeSearched, strSearchFor [, compare])
ARGUMENTS: Start为搜索的起始值,strToBeSearched接受搜索的字符串
strSearchFor要搜索的字符.compare比较方式(详细见ASP常数)
EXAMPLE: <%
strText = "This is a test!!"
pos = Instr(strText, "a")
response.write pos
%>
RESULT: 9
InstrRev()
FUNCTION: 同上,只是从字符串的最后一个搜索起
SYNTAX: InstrRev([start, ] strToBeSearched, strSearchFor [, compare])
ARGUMENTS: 同上.
EXAMPLE: <%
strText = "This is a test!!"
pos = InstrRev(strText, "s")
response.write pos
%>
RESULT: 13
Int()
FUNCTION: 返回数值类型,不四舍五入,注意取值是不大于它的整数。
SYNTAX: Int(number)
ARGUMENTS:
EXAMPLE: <%=INT(32.89)%> <%=int(-3.33)%>
RESULT: 32 -4
IsArray()
FUNCTION: 判断一对象是否为数组,返回布尔值 .
SYNTAX: IsArray(name)
ARGUMENTS:
EXAMPLE: <%
strTest = "Test!"
response.write IsArray(strTest)
%>
RESULT: False
IsDate()
FUNCTION: 判断一对象是否为日期,返回布尔值
SYNTAX: IsDate(expression)
ARGUMENTS: expression is any valid expression.
EXAMPLE: <%
strTest = "8/4/99"
response.write IsDate(strTest)
%>
RESULT: True
IsEmpty()
FUNCTION: 判断一对象是否初始化,返回布尔值.
SYNTAX: IsEmpty(expression)
ARGUMENTS:
EXAMPLE: <%
Dim i
response.write IsEmpty(i)
%>
RESULT: True
IsNull()
内容版权声明:除非注明,否则皆为本站原创文章。