ASP Common Function Array () Function: Returns an array syntax: array (list) arguments: characters, numbers can be elimple: <% Dim MyArray () for i = 1 to 7 redim preserve myarray (i) MyArray (i) = weekdayname (i) Next%> Result: established an array of 7 elements MYArraymyArray ("SUNDAY", "Monday", ... "SATURDAY") CINT () Function: Transform an expression into a digital type Syntax: Cint (Expression) arguments: Any valid character can be eXample: <% f = "234" Response.write CINT (f) 2%> Result: 236 Transformation Character "234" is a number "234", if character The string is empty, then the 0 value creteObject () function: Establish and return an instance of a registered ActiveX component. Syntax: creteObject (objName) arguments: ObjName is the name of any valid, registered ActiveX component. EXAMPLE: <% set con = Server.createObject ("adodb.connection")%> Result: cstr () Function: Transformation The expression is a string. SYNTAX: CSTR (Expression) arguments: expression is any valid expression. Example: <% s = 3 2RESPONSE.WRITE "The Result IS:" & CSTR (S)%> Result: Transformation Number "5" is the character "5". Date () Function: Returns the current system date. Syntax: Date () arguments: none. EXample: <% = DATE%> Result: 8/4/99 dateadd () Function: Returns a changed date. SYNTAX: DateAdd (timeinterval, number, date) ARGUMENTS: timeinterval is the time interval to add; number is amount of time intervals to add; and date is the starting date EXAMPLE: <% currentDate = # 8/4/99 # newDate. = DATEADD ("M", 3, Currentdate) response.write newdate%> <% currentdate = # 12: 34: 45 pm # newdate = dateadd ("h", 3, currentdate) response.write newDate%> Result: 11 / 4/993: 34: 45 PM "M" = "MONTH"; "D" = "day"; if currentdate is in time format the, "h" = "hour"; "s" = "second"; datediff () Function: Returns the difference between the two dates.
Syntax: datediff (timeInterval, date1, date2 [, firstwekofwek]]) arguments: timeInterval indicates the type of time separation, such as "M" means "month". EXAMPLE: <% fromDate = # 8/4/99 # Todate = # 1/1/2000 # response.write "There" & _ Datediff ("D", fromDate, Todate) & _ "Days to Millenium from 8 / 4/99. "%> Result: There are still 150 days from 8/4/99 to 2000. Day () Function: Returns a month of the day. Syntax: day (date) arguments: Date is any valid date . Example: <% = day (# 8/4/99 #)%> Result: 4 formatcurrency () Function: Return expression, this expression is formatted as a currency value syntax: formatcurrency (Expression [, Digit] [, LeadingDigit] [, PAREN] [, GroupDigit]]]) arguments: 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)%> Result: $ 34.35 formatdatetime () function: Return expression, this expression is formatted as a date or time syntax: formatdatetime (date, [, namedformat]) arguments: namedFormat indicator Values used for date / time format, if omitted, use vbGeneralDate. Example: <% = formatdatetime ("08/4/99", vblongdate)%> Result: Wednesday, August 04, 1999 FormatNumber () Function: Return Expression The expression has been formatted as a value. Syntax: formatNumber (Expression [, Digit] [, LeadingDigit] [, PAREN] [, GroupDigit]]]) arguments: 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. (45.324567, 3)%> Result: 45.325 formatpercent () function: Return expression, this expression has been formatted as a percentage of a percentage of the tail (multiplying 100).
(%) SYNTAX: FORMATPERCENT (Expression [, Digit] [, LeadingDigit]]]]]) arguments: 同. EXAMPLE: <% = formatpercent (0.45267, 3)%> Result: 45.267% HOUR () Function: Returns the number of hours in 24. Syntax: Hour (Time) arguments: example: <% = Hour (# 4: 45: 34 pm #)%> Result: 16 (Hour Has Been Converted to 24-Hour System) INSTR () Function: Returns the first place in another string in another string. SYNTAX: INSTR ([START,] STRTOBESEARCHED, STRSEARCHFOR [, Compare]) arguments: start is the starting value of the search, STRTOBESEARCHED Accepts String Strings StrsearchFor To search for characters. Compare comparison mode (detailed view ASP constant) Example: <% strText = "this is a test !!" POS = INSTR (Strtext, "A") Response.write POS% > Result: 9 INSTRREV () Function: The same, just from the last search of Syntax: INSTRREV ([Start,] strtobesearched, strsforchfor [, compare]) arguments: 同. EXAMPLE: <% strText = "this is a Test !! "POS = INSTRRREV (Strtext," S ") Response.write POS%> Result: 13 int () function: Return numeric type, not surrounded, note that the value is not more than its integer.
Syntax: int (Number) arguments: example: <% = int (32.89)%> <% = int (-3.33)%> Result: 32 -4 isarray () function: Determines whether an object is an array and returns a Boolean value. Syntax: Isarray (Name) arguments: example: <% strTrtest = "test!" Response.write isarray ()%> Result: false isdate () function: Date to determine if an object is a date, return to Boolean Syntax: Isdate (Expression) ) Arguments: expression is any value: <% strast = "8/4/9" response.write isdate (strtest)%> Result: True ISEMPTY () Function: Determines whether an object is initialized, return to Boolean. Syntax : ISempty (Expression) arguments: example: <% DIM IRESPONSE.WRITE ISEMPTY (i)%> Result: True Isnull () Function: Determines whether an object is empty, return to Boolean. Syntax: isnull (Expression) arguments: example: <% DIM IRESPONSE.WRITE ISNULL (i)%> Result: false isnumeric () function: Determines whether an object is a number, return to Boolean. Syntax: isnumeric (expression) arguments: example: <% i = "345" response. Write isnumeric (i)%> Result: True Even if the number adds quotation marks, ASP still thinks it is a number. IsObject () function: Determines if an object is an object, returns a Boolean value. Syntax: isobject (expression) arguments: example: <% set con = Server.createObject ("AdoDb.Connection) Response.write isobject (con)%> Result: True Lbound () Function: Returns the minimum subscript of the specified array dimension. Syntax: lbound (arrayname [, dimension]) arguments:; Dimension indicates which one dimension to return. Use 1 to represent the first dimension, 2 represents the second dimension, and so on.
If the Dimension parameter is omitted, the default is 1. EXAMPLE: <% i = array ("Monday", "Tuesday", "Wednesday") Response.write LBound (i)%> Result: 0 Lcase () Function: Return Strings Small write form syntax: lcase (string) arguments: string is any valid string expression. EXAMPLE: <% strate = "this is a test!" Response.write lcase (strTrtest)%> Result: this is a test! Left () Function: Returns the previous character (containing ZENGTH characters) on the left side of the string (including ZENGTH characters). Syntax: Left (string, length) arguments: example: <% strTest = "this is a test!" Response.write LEFT , 3)%> Result: thi g () Function: Returns the length of the string. Syntax: len (string | varname) arguments: example: <% strTrtest = "this is a test!" Response.write Len (strTest)% > Result: 15 Ltrim () Function: Remove the space left on the string. Syntax: Ltrim (String) arguments: example: <% strTrtest = "this is a test!" Response.write ltrim (strtst)%> Result: this is A Test! MID () Function: Returns a specific length string (starting from START, length length). Syntax: MID (String, Start [, Length]) arguments: example: <% strate = "this is a test! Today is monday. "Response.write Mid (StRTE ST, 17, 5)%> Result: Today Minute () Function: Return time division. Syntax: Minute (Time) arguments: example: <% = minute (# 12: 45: 32 pm #)%> Result: 45 MONTH () Function: Return date. Syntax: Month (Date) arguments: Date is any value value: <% = 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: <% = no%> Result: 8/4/99 9:30:16 am replace () FUNCTION: Returns a string in which a specified substring 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 indeicating the comparision constant. EXAMPLE: <% strTestSt = "This is an apple!" Response.write replace (StRTEST, "Apple", "Orange")%> Result: this is an orange! Right () function: Returns the previous character of the word Length in the right of the character (including Double-character). Syntax: Right (string, length) arguments:. EXample: <% strTrtest = "this is an test!" Response.write Right (strtst, 3)%> Result: st! Rnd () Function: Generate a random number. Syntax: RND [(Number)] arguments: example: <% randomize () response.write rnd ()%> Result: Number of Round () Function between 0 and 1 () Function: Return Press specified The number of digits is rounded. Syntax: Round (Expression [, nuMright]) arguments: Numright number indicates how many counts in the right side of the decimal point.
If omitted, the Round function returns an integer. EXAMPLE: <% i = 32.45678RESPONSE.WRITE ROUND (i)%> Result: 32 RTRIM () Function: Remove the string on the right side of the string. Syntax: Rtrim (String) arguments: Example : <% strTest = "this is a test !!" response.write rtrim (strTRTEST)%> Result: this is a test !! second () function: Return second. Syntax: second (time) arguments:. eXample: < % = SECOND (# 12: 34: 28 PM #)%> Result: 28 strreverse () Function: Reverse row string Syntax: strreverse (string) arguments: example: <% strTrtest = "this is a test !!" Result: !! tset a si siht time () function: Return system time. Syntax: Time () arguments:. example: <% = time%> Result: 9:58:28 AM Trim () function: Remove the space left and right. Syntax: Trim (String) arguments: string is any valid string expression. EXAMPLE: <% strTrtest = "this is a test !!" Response.write Trtem (strtest)%> Result: this is a test !! Ubound () Function: Returns the maximum available subscript of the specified array dimension. Syntax: ubound (arrayname [, dimension]) arguments:; Dimension (optional) Specifies which one-dimensional upper boundary . 1 Represents the first dimension, 2 means a second dimension, and so on.