VBScript function set

zhaozj2021-02-16  54

1. Function array () function: Create an array variable format: array (list) parameter: List is a numerical column in array variables, with comma intervals: <% i = array ("1", "2" , "3")%> Result: I is given to array 2. Function CINT () function: Convert an expression / other type of variable into an integer type (int) format: cint (expression) Parameters: Expression is any effective Expression / Other types of variable examples: <% f = "234" Response.write CINT (f) 2%> Result: 236 Function CINT () Convert Character "234" into an integer 234. If the expression is empty When it is invalid, the return value is 0; 3. Function: CreatObject () function: Create and return an ActiveX object. Format: CreatObject (OBNAME) parameter BNAME is an object's name example: <% set con = Server.createObject (" AdoDb.connection ")%> Results: 4. Function CSTR () function: Convert a expression / other type of variable into a string format: cstr (expression) parameter: expression is any valid expression / other Type Variable Example: <% S = 3 2 Response.write "The Res:" & CSTR (S)%> Result: Function CSTR () converts integer 5 into characters "5". 5. Function Date () Function: Returns the date format of the current system (SERVER): Date () parameter: no example <% DATE ()%> Result: 05/10/00 6. Function dateAdd () function: calculate a specified time and format : Dateadd (TimeInterval, Number, Date) Parameters: TimeInterval is the time unit (month, day ..); Number is the time interval value, Date is the time point. 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%> Results: 11/4/99 3:34:45 PM where "M" = "Month"; "D" = " "; if it is currentdate format," h "=" hour ";" s "=" second "; 7. Function datediff () function: calculate a specified time difference format: Datediff (TimeInterval, Date1, Date2 [, firstdayofweek [, firstdayofyear]]) Parameters: TimeInterval is a time unit; DATE1, DATE2 is a valid date expression, firstdayofweek, firstdayofyear is any option. example: <% fromdate = # 8/4/99 # Todate = # 1 / 1/2000 # Response.write "There" & _ Datediff ("D", fromDate, Todate) & _ "Days to Millenium from 8/4/99."%>

RESULTS: There Are 150 Days to Millenium from 8/4/99. 8. Function Day () Features: Returns an integer value, corresponding to a certain day format of the month: DAY (date) Parameters: Date is a valid date expression ; Example <% = Date (# 8/4/99 #)%> Results: 4 9. Function FormatCurrency () Function: Convert to Currency Format Format: Formatcurrency (Expression [, Digit [, LeadingDigit [, PAREN [, GroupDigit ]]]]) Parameters: Expression is a valid digital expression; DIGIT represents the number of digits after the decimal point; LeadingDigit, Paren, GroupDigit is any option. Example <% = formatcurrency (34.3456)%> Result 34.35 10. FunctionDateTime () Function: Formatting Date Expression / Variable Format: FormatorTime (Date [, NameFormat]) Parameters: Date is a valid date expression / variable; NameFormat is the specified date format constant name. Example <% = formtdatetime ("08/04 / 99 ", vblongdate)%> Results: Wednesday, August 04, 1999 Description: -------------------------------- ------------------------------------------------ Description Back Expression, this expression has been formatted as a date or time. Syntax formatdatetime (date [, namedformat]) The syntax of the formatDateTime function has the following parameters: Parameter Description Date must be selected. The date expression to be formatted. NamedFormat options. Indicates the value of the date / time format used, if omitted, use VBGeneLDate.

Setting the nameDFormat parameter may have the following values: constant value description VbGeneLDate 0 Displays the date and / or time. If there is a date part, the part is displayed as a short date format. If there is a time part, the part is displayed as a long-time format. If all exist, all parts are displayed. VBlongDate 1 displays the date using the long-term format specified in your computer zone setting. VBShortDate 2 Displays the date using the short date format specified in the computer area settings. VBlongTime 3 Displays time using the time format specified in the computer area setting. VBShortTime 4 shows time using 24-hour format (HH: mm).

Description The following example uses the formatdatetime function to format the expression into a long-term type and assign it to myDatetime: Function getCurrentDate "formatdatetime puts the date type into long-term type. GetCurrentDate = formatdime (date, 1) end function ---- -------------------------------------------------- ----------------------------

11. Function ISNUMERIC () Function: Returns a Boolean value, determine if the variable is a digital variable, or can convert other variables of the number. Format: isNuMeric (Expression) Parameters: Expression is any variable. Example: <% i = "234" Response.Write ISNUMERIC (i)%> Result: True. 12. Function isobject () Features: Returns a Boolean value, determine if the variable is the variable of the object, format: isobject (expression) parameter: Expression is arbitrary variable Example: <% set con = Server.creatobject ("adodb.connection") response.write isobject (con)%> RESUL 13. Function: lbound () Features: Return to a population of an array. Format: lbound (ArrayName [, DIMENSION]) Parameters: ArrayName is an array variable, Dimension is any example: <% i = array ("1", "2", "3") Response.Write Lbound (i)%> Result: 014. function LCASE () function: Transform the characters of a character type variable transform lowercase characters. Format: LCase (String) Parameters: string is a string variable example: <% str = "this is lcase!" Response.write Lcase (STR)% > Result: This is lcase! 15. Function Left () function: Intercepting the front portion of a string; format: Left (string, length) parameter: String string, length intercepting the length. Example: <% = left (" This is a test! ", 6)%> Result: This i 16. Function LEN () function: Return the byte length format of the string length or variable: LEN (String * varName) parameter: string string; varname arbitrary Variable Name Example: <% strate = "this is a test!" Response.write left (strTrtest)%> Result: 15 17. Function Ltrim () function: remove Space before string. Format: Ltrim (String) Parameters: String string. Example: <% = ltrim ("this is a test!") Result: this is a test! 18. Function MID () function: from characters The string is intercepted. Format: MID (String, Start [, Length]) Parameters: String string, starting point of START interception, Length to intercept the length. Example: <% strTest = "this is a test, Today is Monday "Response.write MID (strTest, 17, 5)%>: Today 19. Function system () function: Return a value, indicating a minute format: Minute (TIME) Parameters: Time is the time variable example lt;% = Minute (# 12: 23: 34 #)%> Results: 23 20. Function Month () Function: Returns a value, indicating the month format: Month (Time) parameter: Time is the date variable example <% = month (# 08/09 / 99)%> Result: 9 [color = # 1e90ff] 21. Function MONTHNAME () [/ color] function: Return the string of the month (name). Format: MONTHNAME (Date [, ABB]) Parameters: Date is the date The abbreviation of the month when ABB = TRUE is: <% =

MONTHNAME (# 4/5/99 #)%> April 22. Function Now () Function: Return to the current time and date of the system. Format: now () parameter: no example: <% = now ()%> Result : 05/10/00 8:45:32 PM 23. Function: Replace () Features: Find in the string, replace the specified string. Format: Replace (Strtobesearched, Strsearchfor, Strreplacewith [, Start [, Count [, Compare]]]) Parameters: Strtobesearched is a string; strSearchfor is a sub-string that is found; StrReplaceWith is a substring for replacement .Start, count, compare is any option. example: <% strTest = "this is an an Apple. "Response.Write Replace (StRTEST," Apple "," Orange ")%> Result: This is an orange. 24. Function Right () Features: Intercepting a string after partial format: Right (String, Length) Parameters: String string, length intercepting length. Example: <% strTest = "this is a test!" Response.write Right (strTest, 3)%> Result: ST! 25. Function RND () function: Return a random Numerical format: RND [(Number)] Parameters: Number is any value. Example: <% randomize () response.write rnd ()%> Result: 0/1 Numeric, no randomize (), no random number Function ROUND () Function: Round (Expression [, Numright]) Parameters: Expression Digital Expression; Numright Any Options. Example: <% i = 12.33654 Response.Write Round (i)%> Result: 12 27. Function RTRIM () function: The space after the string is removed. Format: Rtrim (String) Parameters: string is a string example: <% response.wr ITE RTRIM ("this is a test!")%> This is a test! 28. Function Second () function: Return to an integer value. Format: Second (Time) Parameters: Time is a valid time expression; Example lt;% = second (# 12: 28: 30 #)%> Result: 30 29. Function strreverse () function: Return the string of the original string inverse. Format: strhuang (String) Parameters: String is a character String example <% = STRREVERSE ("this is a test!") Result:! Tset A Si SIHT 30. Function Time () Features: Returns the time value of the current system. Format: Time () parameter: No Results: 9: 58 : 28 AM 31. Function Trim () Function: Delete the string before, after the space. Format: Trim (String) Parameters: String string. Example: <% strTest = "this is a test!" Response.write Trim (strTest)%> Result: This is a test! 32. Function Ubound () Features: Returns the upper bound of an array. Format: Ubound (Expression [, Dimension]) Parameters: Expression is an array expression / array variable, Dimension is Any example: <% i =

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

New Post(0)