ASP function

zhaozj2021-02-16  55

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, "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 conversion character "234" is a number "234", if the string is empty Return 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 [, Firstdayofweek [, Firstweekofweear]]) arguments: timeInterval indicates the type of the separation time, 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 [, Paren [, GroupDigit]]]) arguments: 同. EXAMPLE: <% = formatpercent (0.45267, 3)%> Result: 45.267% HOUR () Function : Return to hours at 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 appearance of the character or string in another string. SYNTAX: INSTR ([START,] STRTOBESEARCHED, STRSEARCHFOR [, Compare]) arguments: start is the starting value of the search, STRTOBESEARCHED accepts a search String 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: Same as above, just from the last search of Syntax: Instrrev ([Start,] strtobesearch, strsearchfor [, compare]) arguments: 同. EXAMPLE: <% strText = "this is a test !! "POS = INSTRRRRREV (STRText," S ") Response.write POS%> Result: 13 int () function: Returns a numeric type, not surrounded.

Syntax: int (Number) arguments: example: <% = int (32.89)%> Result: 32 isarray () function: Determined whether an object is an array, return to the Boolean value. Syntax: isarray (name) arguments: example: <% Strtest = "Test!" Response.write isarray ()%> Result: false isdate () function: Determines if an object is a date, return to Boolean syntax: isdate (expression) arguments: expression is any value valid expression. EXAMPLE: < % stratest = "8/4/99" response.write isdate (strtest)%> Result: True ISEMPTY () Function: Determine whether an object is initialized, return to Boolean value. Syntax: ISEMPTY (Expression) arguments: example: <% DIM IRESPONSE.WRITE ISEMPTY (I)%> RESUE ISNULL () function: Determines if an object is empty, return to Boolean value. Syntax: isnull (Expression) arguments: example: <% DIM IRESPONSE.WRITE ISNULL (i)%> Result: false isnumeric () Function: Determines if an object is a number, return to the Boolean value. Syntax: isnumeric (expression) arguments: example: <% i = "345" Result: True Events Number of RESULT: TRUE Added quotes, 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 of the dimensions to returns. 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 (StRTEST, 17, 5)%> Result: Today Minute () Function: Return time. Syntax: Minute: <% = minute (# 12: 45: 32 pm #)%> Result: 45 MONTH () Function: Return date. Syntax: Month (Date) arguments: Date is any valid date Expression. EXAMPLE: <% = 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: <% strTest = "this is an apple!" Response.write replace (StRTEST, "Apple", "Orange")%> Result: this is an an anal! Right () function: Returns the character (including Changth characters) in the right side of the string. SYNTAX: Right (string, length) arguments :. example: <% strTrtest = "this is an item!" Result: st! rnd () Function: Produces a random number. Syntax: RND [(Number)] arguments: example: <% randomize () Response.write rnd ()%> Result: Any number of Round () function between 0 and 1: Returns the value of the number of rounds, Syntax: Round (Expression [, Numright]) Arguments: Numright Digital indicates how many of the counts of decimal points.

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 (strtst)%> 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: Returns 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) Specify which dimension of the returned Integer. 1 Represents the first dimension, 2 means a second dimension, and so on.

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

New Post(0)