ASP common functions

xiaoxiao2021-03-06  110

Array () function Returns an array expression array (list) Allow data type: characters, numbers can be instances: <% DIM MyArray () for i = 1 To 7redim Preserve MyArray (i) MyArray (i) = weekdayName (i) Next%> Return Result: Create an array of 7 elements with MyArraymyArray ("Sunday", "Monday", ... "SATURDAY")

CINT () function converts an expression into a digital type expression CINT (Expression) Allow data type: Any valid character can be (not more than 32767) instance: <% f = "234" response.write CINT (f) 2%> Return Result: 236 Transformation Character "234" is a number "234", if the string is empty, return 0 value

The CreateObject () function establishes and returns an instance of a registered ActiveX component. Expression CreateObject (ObjName) Allow Data Type: ObjName is a name for any valid, registered ActiveX component. Instance: <% set con = Server.createObject ("AdoDb.Connection")%>

CSTR () function transforms an expression as a string. Expression CSTR (Expression) Allows data type: Expression is any valid expression. Example: <% s = 3 2RESPONSE.WRITE "The Return Results IS:" & CSTR (S)%> Return Result: Transformation Number "5" is the character "5".

Date () function returns the current system date. Expression Date () Allow data type: none. Instance: <% = DATE%> Return Results: 9/9/00

The dateAdd () function returns a changed date. Expression Dateadd (TimeInterval, Number, Date) Allowed Data Type: TimeInterval Is The Time Interval To Add; Number IS Amount of Time Interval To Add; And Date Is The Starting Date. Instance: <% 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/003: 34: 45 PM "M" = "MONTH"; "D" = "day"; if currentdate is in time format the, "h" = "hour"; "s" = "SECOND "

The dateDiff () 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/00 # Todate = # 1/1/2000 # response.write "there" & _datediff ("D", fromdate, today) & _ "days to millenium from 9/9 / 00. "%> Return Result: There are still 150 days from 9/9/00 to 2000. Day () function returns a month. Express DAY (date) Allow data type: Date is any effective date. Example: <% = day (# 9/9/00 #)%> Return Result: 9

FormatCurrency () function returns an expression, this expression is formatted as a currency-value expression formatcurrency (Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]) Allow data type: DIGIT indicates the right side of the decimal point Number of bits. 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 Result: $ 34.35

The formatdatetime () function returns an expression. This expression is formatted as a date or time expression formatdateTime (Date, [, NamedFormat]) Allow the data type: NamedFormat indicates the value of the date / time format used, if omitted, Use VBGeneralDate. Instance: <% = formatdatetime ("09/9/00", vblongdate)%> Return Result: Sunday, September 09, 2000

The formatNumber () function returns the expression. This expression has been formatted as a value. Expression FormatNumber (Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]) Allow data type: DIGIT indicates the right side of the decimal point Number of bits. 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

The formatpercent () function returns an expression that is formatted as a percentage of the percentage of the tail (multiplying 100). (%) Expression Formatpercent (Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]) Allow data types: Ibid. Instance: <% = formatpercent (0.45267, 3)%> Return Result: 45.267%

The Hour () function returns a small number of hours at 24. Expressions HORE (TIME) Allow data type: instance: <% = Hour (# 4: 4: 34 PM #)%> Return Results: 16 (HOUR HAS BEEN CONVERTED TO 24 -Hour system) Instr () function Returns the first place in another string. Expression INSTR ([Start,] Strtobesearched, StRSearchfor [, Compare]) Allow data type: start is a search Start value, Strtobesearched Accept String String strSearchFor To search for characters. Compare comparison mode (detailed view ASP constant) instance: <% strText = "this is a test !!" POS = ISTR (Strtext, "A") Response .write pos%> Return Result: 9

The INSTRREV () function is the same, just from the last search of the character string, the expression INSTRREARCHED, STRSEARCH, COMPARE]) allows data type: Ibid. Instance: <% strText = "this is a test !! "POS = INSTRREV (Strtext," S ") Response.write POS%> Return Result: 13

The int () function returns a numeric type and does not go round. Expression INT (NUMBER) Allow Data Type: Instance: <% = INT (32.89)%> Return Result: 32

Isarray () function determines whether an object is an array, returns a Boolean value. Expression isarray (name) instance: <% straTest = "test!" Response.write isarray (strTest)%> Return Result: False

Isdate () function determines whether an object is a date, return to Boolean expression isdate (expression) instance: <% strate = "9/4/2000" response.write isdate (strTest)%> Return Result: True

ISEMPTY () function determines whether an object is initialized, return to Boolean value. Expression ISEMPTY (EXPRESSION) instance: <% DIM IRESPONSE.WRITE ISEMPTY (i)%> Return Result: True

The isnull () function determines whether an object is empty, return to Boolean value. Expression ISNULL (Expression) instance: <% DIM IRESPONSE.WRITE ISNULL (i)%> Return Result: False

IsNumeric () function determines whether an object is a number, return to Boolean. Expression ISNUMERIC (EXPRESSION) instance: <% i = "345" response.write isnuMeric (i)%> Return Result: True Events Digital plus quotation marks, ASP Still think it is a number.

IsObject () function determines whether an object is an object, returns a Boolean value. Expression ISObject (Expression) Instance: <% set con = Server.createObject ("adodb.connection" Response.write isobject (con)%> Return Result: True

The LBound () function returns the minimum available subscript of the specified array dimension. Expressions LBound (ArrayName [, Dimension]) instance: <% i = array ("Monday", "Tuesday", "Wednesday") Response.write LBound (i )%> Return Result: 0lcase () function Returns the lowercase form of the string LCASE (String) instance: <% strTest = "this is a test!" Response.write Lcase (strTest)%> Return Result: this is a Test!

LEFT () function returns a character (including Zength characters) previous characters (including ZENGTH characters) on the left side of the string. Expression Left (String, Length) instance: <% strate = "this is a test!" Response.write Left (strTest " , 3)%> Return Results: THI

The LEN () function returns the length of the string. Expression LEN (String | VarName) instance: <% strTest = "this is a test!" Response.write len (strTtest)%> Return Result: 15

The LTRIM () function removes the space left on the left side of the string. Expression Ltrim (String) instance: <% strate = "this is a test!" Response.write Ltrim (strTrtest)%> Return Result: this is a test!

The MID () function returns a specific length string (starting from START, length length). Expression MID (String, Start [, Length]) instance: <% strate = "this is a test! Today is monday." Response .write MID (Strtest, 17, 5)%> Return Result: Today

Minute () function returns time minutes. Expression Minute (TIME) instance: <% = minute (# 12: 45: 32 PM #)%> Return Result: 45

Month () function returns the date. Expressions Month (Date) instance: <% = month (# 08/04/99 #)%> Return Result: 8

MONTHNAME () function returns the specified month expression MONTHNAME (Month, [, ABB]) instance: <% = monthname (Month (# 08/04/99 #))%> Return Result: August

NOW () function return system time expression now () instance: <% = no%> Return Results: 9/9/00 9:30:16 AM

Right () function Returns the character (including Changth characters) in the right side of the string (including ZENGTH characters). Expressions Right (String, Length) instance: <% strate = "this is an item!" Response.write Right (strTest) 3)%> Return Result: ST!

The RND () function generates a random number. Expression RND [(Number)] instance: <% randomize () Response.write rnd ()%> Return Result: Number of Number of 0 to 1

The Round () function returns the value of the number of rounded numbers. Expression Round (Expression [, nuMright]) instance: <% i = 32.45678Response.write round (i)%> Return Result: 32rtrim () function removes the string String on the right. Expression RTRIM (String) instance: <% strTest = "this is a test !!" response.write rtrim (strttest)%> Return Result: this is a test !!

The split () function splits a string and returns a split result expression split (s [d]) instance: <% v = split (a, b, c) for i = 0 to Ubound (V) Response.write V (i) Next%> Return Result: ABC

Second () function returns second. Expressions Second (Time) instance: <% = second (# 12: 34: 28 pm #)%> Return Result: 28

Strreverse () Function Reverse Rolling A String Expression Strreverse (String) Instance: <% strate = "this is a test !!" response.write strreverse (strTrtest)%> Return Result: !! Tset A Si SIHT

Time () function returns to system time. Expression Time () instance: <% = time%> Return Results: 9:58:28 AM

The Trim () function removes the space for the string. Expression Trim (String) instance: <% strate = "this is a test !!" Response.write Trim (strtest)%> Return Result: this is a test !!

Ubound () function Returns the maximum available subscript of the specified array dimension> Expressions Ubound (ArrayName [, Dimension]) instance: <% i = array ("Monday", "Tuesday", "Wednesday" Response.write Ubound (i)%> Return Result: 2

UCASE () function returns the upper business of the string. Expression ucase (string) Allow data type: instance: <% strTest = "this is a test !!" response.write ucase (strTrtest)%> Return Results: this is a Test !!

VARTYPE () function returns a value expression VARTYPE (VarName) instance: <% i = 3RESPONSE.WRITE VARTYPE (i)%> Return Result: 2 (Digital) See "ASP constant"

Weekday () function returns in the first few days of week. Expression weekday (Date [, firstdayofweek]) instance: <% d = # 9/9/00 # Response.write weekday (D)%> Return Result: 4 (Wednesday )

WeekdayName () function returns the name of the first few days. Expression weekdayname (Weekday [, ABB [, Firstday Fweek]]) Instance: <% D = # 9/9/00 # Response.write WeekDayName (WeekDay (D))% > Return Result: Wednesday

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

New Post(0)