ASP series functions

xiaoxiao2021-04-05  249

ASP function

The ASP function is similar to VBScript, and there are some common functions.

Array ()

Function returns an array

Expression array (list)

Allow data types: characters, numbers

Example: <%

DIM myArray ()

For i = 1 to 7

Redim Preserve MyArray (i)

MyArray (i) = weekdayName (i)

NEXT

%>

Return Result: Create a array of 7 elements with MyArray

MyArray ("Sunday", "Monday", ... "SATURDAY")

Cint ()

The function converts an expression into a digital type

Expression CINT (EXPRESSION)

Allow data types: any valid characters

Example: <%

f = "234"

Response.write cint (f) 2

%>

Return Result: 236

The conversion character "234" is a number "234", and if the string is empty, return 0 value

CreateObject ()

The function establishes and returns an instance of a registered ActiveX component.

Expression CreateObject (ObjName)

Allow data types: ObjName is the name of any valid, registered ActiveX component.

Example: <%

Set con = Server.createObject ("AdoDb.Connection")

%>

CSTR ()

A function transforms an expression as a string.

Expression CSTR (Expression)

Allow data types: Expression is any valid expression.

Example: <%

S = 3 2

Response.write "THE Return Results IS:" & CSTR (s)

%>

Return Result: Transforming Number "5" is character "5".

Date ()

The function returns the current system date.

Expression Date ()

Allow data types: None.

Example: <% = DATE%>

Return Results: 9/9/00

Dateadd ()

The function returns a changed date.

Expression Dateadd (TimeInterval, Number, Date)

Allow data types:

TimeInterval is the Time Interval to Add;

Number IS Amount of Time Interval To Add;

And Date Is The Starting Date.

Example: <%

Currentdate = # 9/9/00 #

NewDate = dateadd ("m", 3, currentdate)

Response.write newdate

%>

<%

Currentdate = # 12: 34: 45 PM #

NewDate = dateadd ("h", 3, currentdate)

Response.write newdate

%>

Return Results: 9/9/00

3:34:45 PM

"m" = "month";

"d" = "day";

IF currentdate is in time format the,

"h" = "hour";

"s" = "second";

Datediff ()

The function returns the difference between the two dates.

Expression Datediff (TimeInterval, Date1, Date2 [, Firstday FirstDayofweek [, Firstweekofyear]]) Allow data type: TimeInterval indicates the type of time separation, such as "M" means "month".

Example: <%

FromDate = # 9/9/00 #

TODATE = # 1/1/2000 #

Response.write "There Are" & _

Datediff ("D", FromDate, Todate & _

Days to Millenium from 9/9/00. "

%>

Returns: 150 days from 9/9/00 to 2000.

Day ()

The function returns a month of the day.

Expression Day (date)

Allow data types: Date is any valid date.

Example: <% = DAY (# 9/9/00 #)%>

Return Result: 4

Formatcurrency ()

Function returns an expression, this expression has been formatted as a currency value

Expression Formatcurrency (Expression [, DIGIT [, LeadingDigit [, Paren [, GroupDigit]]]])

Allow data types: DIGIT indicates the value of the number of digits on the right side of the decimal point. The default value is -1, indicating the area setting of the computer; the LeadingDigit tri-state constant indicates whether the zero in front of the small numerical point is displayed.

Example: <% = Formatcurrency (34.3456)%>

Return Results: $ 34.35

Formatdatetime ()

The function returns the expression. This expression has been formatted as a date or time.

Expression Formator (Date, [, NamedFormat])

Allow data types: NamedFormat indicates the value of the date / time format used, if omitted, use VBGeneLDate.

Example: <% = formatdatetime ("09/9/00", vblongdate)%>

Return Results: Sunday, September 09, 2000

FormatNumber ()

The function returns an expression that is formatted to a value.

Expression FormatNumber (Expression [, DIGIT [, LeadingDigit [, Paren [, GroupDigit]]])

Allow data types: DIGIT indicates the value of the number of digits on the right side of the decimal point. The default is -1, indicating the area setting of the computer. LeadingDigit i indicates the value of the display bits on the right side of the decimal point. The default is -1, indicating the area setting of the computer. PAREN indicates the value of the number of digits on the right side of the decimal point. The default is -1, indicating the area setting of the computer. GroupDigit i indicates the value of the number of digits on the right side of the decimal point. The default is -1, indicating the area setting of the computer. .

Example: <% = FormatNumber (45.324567, 3)%>

Return Results: 45.325

Formatpercent ()

The function returns the expression that is formatted to have a percentage of the percentage of the tail (multiplying 100). (%)

Expression Formatpercent (Expression [, DIGIT [, LeadingDigit [, Paren [, GroupDigit]]]])

Allow data types: Ib.

Example: <% = Formatpercent (0.45267, 3)%>

Return Result: 45.267%

Hour ()

The function returns a small number of hours at 24. Expressions HOUR (TIME)

Allow data types:

Example: <% = Hour (# 4: 45: 34 pm #)%>

Return Result: 16

(HOUR HAS BEEN CONVERTED to 24-HOUR SYSTEM)

INSTR ()

The function returns the character or string where the first appearance in another string.

Expression INSTR ([START,] STRTOBESEARCHED, STRSEARCHFOR [, Compare])

Allow data types: start for the starting value of the search, STRTOBESEARCHED accepts the search for string strSearchFor to search the character. Compare comparison method (detailed view ASP constant)

Example: <%

strText = "this is a test !!"

POS = INSTR (strText, "a")

Response.write POS

%>

Return Result: 9

INSTRREV ()

The function is the same, just from the last search of the string

Expression INSTRREV ([Start,] Strtobesearched, StrsearchFor [, Compare])

Allow data types: Ib.

Example: <%

strText = "this is a test !!"

POS = INSTRREV (Strtext, "S")

Response.write POS

%>

Return Result: 13

Int ()

The function returns a numeric type and does not go all over.

Expression INT (Number)

Allow data types:

Example: <% = INT (32.89)%>

Return Result: 32

Isarray ()

The function determines whether an object is an array and returns the Boolean value.

Expression Isarray (Name)

Example: <%

strTest = "Test!"

Response.write isarray (StRTEST)

%>

Return Result: False

Isdate ()

The function judges whether or not the object is the date, return to Boolean

Expression isdate (Expression)

Example: <%

strTest = "9/4/2000"

Response.write isdate (StRTEST)

%>

Return Result: True

ISempty ()

The function determines whether an object is initialized and returns the Boolean value.

Expression ISEMPTY (EXPRESSION)

Example: <%

DIM I

Response.Write ISempty (i)

%>

Return Result: True

Isnull ()

The function determines whether an object is empty and returns the Boolean value.

Expression ISNULL (EXPRESSION)

Example: <%

DIM I

Response.write isnull (i)

%>

Return Result: False

Isnumeric ()

The function determines whether an object is a number and returns the Boolean value.

Expression ISNUMERIC (EXPRESSION)

Example: <%

i = "345"

Response.write isnumeric (i)

%>

Return Result: True

Even if the number adds quotation marks, ASP still thinks it is a number.

IsObject ()

The function determines whether an object is an object and returns the Boolean value.

Expression ISOBJECT (EXPRESSION)

Example: <%

Set con = Server.createObject ("AdoDb.Connection") Response.write isobject (con)

%>

Return Result: True

Lbound ()

The function returns the minimum subscript of the specified array dimension.

Expression LBound (ArrayName [, Dimension])

Example: <%

i = array ("Monday", "Tuesday", "Wednesday")

Response.write lbound (i)

%>

Return Result: 0

Lcase ()

Function Returns the lowercase form of the string

Expression LCASE (String)

Example: <%

strTrtest = "this is a test!"

Response.write Lcase (StRTEST)

%>

Return Result: this is a test!

Left ()

The function returns a character (including Changth characters) previously character (including Changth characters) on the left side of the string.

Expression Left (String, Length)

Example: <%

strTrtest = "this is a test!"

Response.write Left (strTest, 3)

%>

Return Result: THI

Len ()

The function returns the length of the string.

Expression Len (String | VarName)

Example: <%

strTrtest = "this is a test!"

Response.write len (strTest)

%>

Return results: 15

Ltrim ()

The function removes the space left on the string.

Expression Ltrim (String)

Example: <%

strTrtest = "this is a test!"

Response.write Ltrim (StRTEST)

%>

Return Result: this is a test!

MID ()

The function returns a string of specific lengths (starting from START, length length).

Expression MID (String, Start [, Length])

Example: <%

Strtest = "this is a test! Today is monday."

Response.write Mid (Strtest, 17, 5)

%>

Return Result: Today

Minute ()

The function returns time for time.

Expression Minute (TIME)

Example: <% = minute (# 12: 45: 32 pm #)%>

Return Result: 45

Month ()

Function returns the date.

Expression Month (Date)

Example: <% = MONTH (# 08/04/99 #)%>

Return Result: 8

Monthname ()

Function returns the specified month

Expression MONTHNAME (Month, [, ABB])

Example: <% = monthname (MONTH (# 08/04/99 #))%>

Return Result: August

Now ()

Function returns system time

Expression now ()

Example: <% = no%>

Return Results: 9/9/00 9:30:16 AM

Right ()

The function returns the character (including Changth characters) before the string of the first side character (including Changth characters).

Expression Right (String, Length)

Example: <%

strTest = "this is an test!"

Response.write Right (strTest, 3)%>

Return Result: ST!

RND ()

The function produces a random number.

Expression RND [(NUMBER)]

Example: <%

Randomize ()

RND ()

The function produces a random number.

Expression RND [(NUMBER)]

Example: <%

Randomize ()

Response.write rnd ()

%>

Return Result: Number of any one between 0 and 1

Round ()

The function returns the value of the pointing number to the number of points.

Expression Round (Expression [, nuMright])

Example: <%

i = 32.45678

Response.write Round (i)

%>

Return Result: 32

RTRIM ()

The function removes the string on the right side of the string.

Expression RTRIM (String)

Example: <%

strTest = "this is a test !!"

Response.write Rtrim (StRTEST)

%>

Return Result: this is a test !!

Split ()

The function segments a string and returns the segmentation result

Expression split (s [, d])

Example: <% v = split (a, b, c)

For i = 0 to Ubound (V)

Response.write v (i)

NEXT

%>

Return Result: A B C

SECOND ()

The function returns second.

Expression SECOND (TIME)

Example: <% = second (# 12: 34: 28 pm #)%>

Return Result: 28

Strreverse ()

Function refrigerated string

Expression Strreverse (String)

Example: <%

strTest = "this is a test !!"

Response.Write Strreverse (StRTEST)

%>

Return Result: !! Tset A SI SIHT

Time ()

The function returns to the system time.

Expression TIME ()

Example: <% = Time%>

Return Results: 9:58:28 AM

Trim ()

The function removes the space around the string.

Expression TRIM (String)

Example: <%

strTest = "this is a test !!"

Response.write Trim (StRTEST)

%>

Return Result: this is a test !!

Ubound ()

The function returns the maximum available subscript of the specified array dimension.

Expression Ubound (ArrayName [, Dimension])

Example: <%

i = array ("Monday", "Tuesday", "Wednesday")

Response.write ubound (i)

%>

Return Result: 2

Ucase ()

The function returns the uppercase of the string.

Expression ucase (String)

Allow data types:

Example: <%

strTest = "this is a test !!"

Response.write ucase (StRTEST)

%>

Return Result: this is a test !!

VARTYPE ()

Function Returns the value indicating the variable quantum type

Expression Vartype (VarName)

Example: <%

i = 3

Response.write Vartype (i)

%>

Return Result: 2 (Digital) See "ASP constant" weekday ()

The function returns in the first few days of the week.

Expression Weekday (Date [, Firstdayofweek])

Example: <%

D = # 9/9/00 #

Response.write weekday (d)

%>

Return Result: 4 (Wednesday)

WeekdayName ()

The function returns the name of the first few days.

Expression weekdayName (weekday [, abb [, firstdayofweek]])

Example: <%

D = # 9/9/00 #

Response.write weekdayname (Weekday (D))

%>

Return Result: Wednesday

Year ()

The function returns the current year.

Expression Year (Date)

Example: <% = year (# 9/9/00 #)%>

Return Results: 1999

转载请注明原文地址:https://www.9cbs.com/read-132052.html

New Post(0)