ASP function detailed

xiaoxiao2021-03-06  36

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 (StRTEST)

% [/ IMG]

Result: this is a test !!

Second () Function: Returns Second. Syntax: Second (Time) arguments:. Example: <% = second (# 12: 34: 28 pm #)% [/ img] Result: 28

Strreverse () Function: Reverse rostr string Syntax: strreverse (string) arguments: example: <% strTrtest = "this is a test !!" response.write strreverse (strTrtest)% [/ img] Result: !! tset a Si SIHT

Time () Function: Return to the system time. Syntax: Time () arguments:. Example: <% = time% [/ img] Result: 9:58:28 AM

Trim () Function: Removes the space left and right. Syntax: Trim (String) arguments: string is any valid string expression. EXAMPLE: <% strTrtest = "this is a test !!" RESPONSE.WRITE TRIM (STRTEST)% [ / IMG] Result: this is a test !!

Ubound () Function: Returns the maximum available subscript of the specified array dimension. Syntax: ubound (arrayname [/ img]) arguments: Dimension (optional) Specifies which one-dimensional upper boundary integer. 1 Represents the first dimension, 2 means a second dimension, and so on. If the Dimension parameter is omitted, the default value is 1. EXAMPLE: <% i = array ("Monday", "Tuesday", "Wednesday") Response.write Ubound (i)% [/ img] Result: 2

Ucase () Function: Returns the upper business of the string. Syntax: ucase (string) arguments: example: <% strTrtest = "this is a test !!" response.write ucase (strTrtest)% [/ img] Result: this is IS A test !!

VARTYPE () function: Returns the value of the variable quantum type Syntax: Vartype (VarName) arguments: example: <% i = 3 response.write Vartype (i)% [/ IMG] Result: 2 (Digital) See "ASP constant "

Weekday () Function: Returns on the first few days. Syntax: weekday (Date [, firstdayofweek [/ img]) arguments:. Example: <% d = # 8/4/99 # response.write weekday (D)% [/ IMG] Result: 4 (Wednesday)

WeekdayName () Function: Returns the first day of the day. Syntax: weekdayname (Weekday [, ABB [/ IMG] [/ IMG]) arguments: ABB is optional. Boolean value indicates whether abbreviation represents the name of the day of the week. If omitted, the default value is false, that is, the name of the week. / Img] Result: WednesdayYear () Function: Returns the current year. Syntax: Year (Date) arguments: example: <% = year (# 8/4/99 #)% [/ img] Result: 1999

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% [/ img] Result: established a group containing 7 elements MYARRAY ("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% [/ IMG] Result: 236 Transformation Character "234" is a number "234", if the string is empty, return 0 value

CreateObject () Function: Establish and return an instance of a registered ActiveX component. Syntax: createObject (objName) arguments: ObjName is the name of any valid, registered ActiveX component. EXAMPLE: <% set con = Server.createObject ("AdoDb.Connection")% [/ img] Result:

CSTR () Function: Transforming an expression as a string. Syntax: cstr (expression) arguments: expression is any valid expression. Example: <% s = 3 2 response.write "The result is:" & cstr (s)% [/ img] Result: Transformation Number "5" is the character "5".

Date () function: Returns the current system date. Syntax: Date () arguments: none. EXAMPLE: <% = DATE% [/ img] 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% [/ IMG] <% currentdate = # 12: 34: 45 PM # newdate = dateadd ("h", 3, currentdate) response.write newdate% [ / Img] result: 11/4/99 3: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 [, Firstweekofyear [/ IMG] [/ IMG]) 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. "% [/ Img] Result: There is still 150 days from 8/4/99 to 2000.

Day () Function: Returns a month. Syntax: day (date) arguments: Date is any valid date. EXAMPLE: <% = day (# 8/4/99 #)% [/ img] Result: 4

FormatCurrency () Function: Return expression, this expression is formatted as a currency value syntax: formatcurrency (expression [, Digit [, LeadingDigit [, PAREN [, GroupDigit [/ IMG] [/ IMG] [/ IMG] [/ IMG]) 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)% [/ IMG] Result: $ 34.35

FormatDateTime () Function: Return expression, this expression is formatted as a date or time syntax: formatdatetime (date, [, namedformat [/ img]) arguments: namedFormat Indicates the value of the date / time format used, if omitted Then use vbGeneraldate. Example: <% = formatdatetime ("08/4/99", vblongdate)% [/ img] Result: Wednesday, August 04, 1999FormatNumber () function: Return Expression, this expression has been formatted Value. SYNTAX: FormatNumber (Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit [/ IMG] [/ IMG] [/ IMG] [/ IMG]) 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. EXAMPLE: <% = FormatNumber (45.324567, 3)% [/ img] Result: 45.325

Formatpercent () Function: Returns the expression, this expression is formatted as a percentage of the percentage of the tail (multiplying 100). (%) SYNTAX: FORMATPERCENT (Expression [, DIGIT [, LeadingDigit [, Paren [, GroupDigit [/ IMG] [/ IMG] [/ IMG] [/ IMG]) arguments: The same. EXAMPLE: <% = formatpercent (0.45267, 3)% [/ img] Result: 45.267%

Hour () function: Returns the number of hours at 24. Syntax: Hour (Time) arguments: example: <% = Hour (# 4: 45: 34 pm #)% [/ img] 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, [/ IMG] strtobsearched, strsearchfor [, compare [/ img]) arguments: start is a search Start value, Strtobesearched Accept String String StrsearchFor To search for Character Compare Comparison Method (Detailed View ASP Constant) Example: <% Strtext = "This Is A Test !!" POS = Instr (Strtext, "A") Response .write pos% [/ IMG] Result: 9

INSTRREV () Function: Same as above, only from the last search of Syntax: Instrrev ([Start, [/ IMG] strare [/ IMG]) arguments: 同. EXAMPLE: <% strText = "this Is A Test !! "POS = INSTRREV (STRTEXT," S ") Response.write POS% [/ IMG] Result: 13int () function: Returns the numerical type, not surrounded. SYNTAX: INT (Number) arguments: example: <% = int (32.89)% [/ IMG] Result: 32

Isarray () Function: Determines if an object is an array, returns a Boolean value. Syntax: isarray (name) arguments: example: <% strate = "test!" Response.write isarray (strTest)% [/ img] Result: false

Isdate () function: Judging whether an object is a date, return to Boolean value syntax: isdate (expression) arguments: expression is any valid expression. EXample: <% strate = "8/4/99" Response.write isdate (strTest)% [/ Img] Result: True

ISEMPTY () Function: Determines if an object is initialized, return to Boolean value. Syntax: ISempty (Expression) arguments: example: <% DIM I response.write ISEMPTY (i)% [/ img] Result: TRUE

ISNULL () Function: Determines if an object is empty, return to Boolean. Syntax: isnull (Expression) arguments: example: <% DIM I response.write isnull (i)% [/ img] Result: false isnumeric () function: Function: Determine whether an object is a number, return to the Boolean value. Syntax: ISNUMERIC (Expression) arguments: example: <% i = "345" response.write isnumeric (i)% [/ img] result: True Events number plus quotation marks, ASP Still think it is a number.

IsObject () function: Determine 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)% [ / Img] Result: True

LBound () function: Returns the minimum available subscript of the specified array dimension. Syntax: lbound (arrayname [/ img]) arguments: Dimension indicates which 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 value is 1. EXAMPLE: <% i = array ("Monday", "Tuesday", "Wednesday") response.write lbound (i)% [/ img] Result: 0lcase () Function: Return String's lowercase form syntax: lcase (string) arguments: string is any valid string expression. EXAMPLE: <% string = "this is a test!" Response.write lcase (strTrtest)% [/ img] Result: this is a Test!

LEFT () function: Returns the previous character (containing ZENGTH characters) on the left side of the string (containing parameter). Syntax: Left (string, length) arguments: example: <% strate = "this is a test!" Response.write Left (strTest, 3)% [/ Img] Result: thi

LEN () Function: Returns the length of the string. Syntax: len (string | varname) arguments: example: <% strate = "this is a test!" Response.write len (strTest)% [/ IMG] Result: 15

LTRIM () Function: Remove the space left on the string. Syntax: Ltrim (String) arguments: example: <% strTrtest = "this is a test!" Response.write ltrim (strTest)% [/ img] Result: this is a Test!

MID () function: Returns a specific length string (starting from START, length length). Syntax: MID (String, Start [, Length [/ IMG]) arguments: example: <% strTrtest = "this is a test! Today is Monday. "Response.write MID (StRTEST, 17, 5)% [/ Img] Result: Today

Minute () Function: Return time division. Syntax: minute (time) arguments: example: <% = minute (# 12: 45: 32 pm #)% [/ img] Result: 45

Month () Function: Return date. Syntax: Month (Date) arguments: Date is any value value: <% = month (# 08/04/99 #)% [/ IMG] Result: 8

. MonthName () FUNCTION: Returns a string identifying the specified month SYNTAX: MonthName (month, [, Abb [/ IMG]) 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 #))% [/ IMG] RESULT: AugustNow () FUNCTION : Returns the current system date and time. Syntax: now () arguments: None Example: <% = no% [/ img] 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 [/ IMG] [ / IMG] [/ IMG]) 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 Indicating The Comparision Constant. EXAMPLE: <% strTRTANT = "this is an apple!" Response.write Replace (StRTEST, "Apple", "Orange") % [/ Img] Result: this is an an anaNGe!

Right () Function: Returns the character (containing ZENGTH characters) in the right side of the string (including ZENGTH characters). SYNTAX: Right (string, length) arguments:. Example: <% strTrtest = "this is an test!" Response. Write Right (strTest, 3)% [/ IMG] Result: ST!

RND () Function: Generate a random number. Syntax: RND [(Number) [/ IMG] arguments: example: <% randomize () response.write rnd ()% [/ img] Result: Any one is 0 to 1 Number of times

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

New Post(0)