ASP Functions

ASP functions are not case sensitive.
ASP functions are located between <% %>.
Below are some common ASP functions with coding examples.

ASP Function Description
of ASP Function
Example
of ASP Function
web
Loops
Do Until – Loop   count = 1
Do Until count = 3
   count = count +1
Loop
web
Do While – Loop   count = 1
Do While count <> 3
   count = count +1
Loop
web
Response Functions
Response.Redirect Redirect to another web page Response.Redirect “default.asp”
web
Response.Write Display text on web page Response.Write “Hi!”
web
Date and Time Functions
web
Date Current date Date()
web
Now Current date and time Now()
web
Day Day of month from 1 to 31 Day(Date()) OR Day(Now())
web
Month Month of year from 1 to 12 Month(Date()) OR Month(Now())
web
Year Year Year(Date()) OR Year(Now())
web
MonthName Name of the Month MonthName(Month(Date())) OR MonthName(Month(Now()))
web
Weekday Day of the week from 1 (Sunday) to 7 Weekday(Date())
web
Time Current time Time()
web
Minute Minute from 0 to 59 Minute(Now) OR Minute(Time)
web
Second Second from 0 to 59 Second(Now) OR Second(Time)
web
String Functions
web
Chr Returns character value of number between 0 and 255 See asp-characters.asp
web
FormatCurrency Display a number in currency format FormatCurrency(“1003.99″)
web
FormatNumber Display a number in double format with the designated positions after the decimal FormatNumber(1003.9987987,2)
web
inStr Finds text in a string starting from left inStr(Description,”Tom”)

If inStr(emailAddress, “@”) = 0 Then

web
inStrRev Finds text in a string starting from right inStrRev(Description,”Betty”)

If inStr(emailAddress, “@”) = 0 Then

web
isDate Checks if string is a valid date isDate(#02/30/20#)
web
isNumeric Checks if string is a valid number isNumeric(“123gfd”)
web
lCase Lower case lCase(“TOM”)
web
uCase Upper case uCase(“tom”)
web
Len Length of string If Len(firstName) <> 0 Then
web
Replace Replace one string with another Replace(description,”Tom”,”Ted”)
web
Left   Left(“How are you”,5)
web
Mid   Mid(“How are you”,4,2)
web
Right   Right(“How are you”,3)
web
Trim Remove spaces from start and finish of string Trim(” How are you? “)

About 智足者富

http://chenpeng.info

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>