VBScript function

xiaoxiao2021-03-06  68

VBScript function function Description Example ABS (value) absolute value. A number of absolute values ​​is its positive value. The absolute value of the empty string (NULL) is also an empty string. The variables that are not initialized are absolutely 0 examples: ABS (-2000) Result: 2000ARRAY (with a tendon separated array element) Array function retracts the value of array elements. Example: a = array (1, 2, 3) B = a (2) Result: 2 Description: Variable B is the value of the second element of the A array. ASC (string) converts the first letters of the string into ANSI (National Standard Symbol). Example: ASC ("Internet") Result: 73 Description: Displays the ANSI word code of the first letter i. CBOOL (Expression) Converts into a Boolean logic value variable (TRUE or FALSE) example: CBOOL (1 2) Result: True CDATE (date expression) replaces a date variable. You can use the isdate function to determine if it can be converted into the date. Example: cdate (now () 2) Result: 2000/5/28 10:30:59 CDBL (expression) Convert to Double variable. CHR (ANSI word) converts the ASCII word code into characters. Example: CHR (72) Result: h cint converted into an integer variable state. Example: CINT ("3.12") Result: 3 CLNG (Expression) Convert to Long Variable Sample. CSNG (expression) is converted into a Single variable. CSTR (Expression) Converts to a string variable. Date () TOP backup system date. Example: Date Result: 2000/5 / 13DATEADD (I, N, D) Plus a date later after a date. I: Set a period of time (DATE) plus a period of time. For example, interval = "d" means that the unit of N is the day. The set value of i is as follows: YYYY Year Year Q Quarter M Month Month D Day Day W Weekday Week HOUR Time N Minute Division S Second Second N: Value Expression, Set a date with a date, can be The positive or negative value, the positive value represents the addition (the result of> DATE), and the negative value is reduced (the result is> Date previous date). D: Date to be subtracted. Example: DATEADD ("M", 1, "31-JAN-98") Result: 28-Feb-98 Description: Add a date 31-Jan-98 plus a month, resulting 28-Feb-98 rather than 31- Fe-98.

Example: DateAdd ("D", 20, "30-JAN-99") Results: 1999/2/9 Description: Add a date 30-JAN-99 to 20 days later. Datediff (i, d1, d2 [, fw [, fy]]) calculates the period between two dates. I: Set the period of calculation between two dates. For example,> i = "m" indicates the calculated unit as the month. > I's set value such as yyyy> Year Year Q Quarter M Month Month D Day Day W Weekday Week HOUR Time M minute division S Second Seconds D1, D2: Two date expressions during calculation, if> Date1 Besides, the results between the two dates are positive; if> DATE2 is earlier, the result is a negative value. FW: Set the week a week for the week, if it is not set as Sunday. > The setting value of the FW is as follows: 0 Use the> API setting value. 1 Sunday 2 Monday 3 Tuesday 4 Wednesday 5 Thursday 6 Friday 7 Saturday FY: Set the first week of one year, if it is not set, it means that the week is the first week of one year. > The set value of FY is as follows: 0 Use the> API setting value. January 1st, the first week of one year, at least four days, the first week of the first week of one year, 3 included the first week of seven days, the first week of one year: datediff ("D "" 25-MAR-99 "," 30-JUN-99 ") Results: 97 Description: Show the period between the two dates to 97 days. DatePart (i, d, fw [, fw]] is transmitted back to some of the date. > I: Set back to that part. For example,> i = "d" indicates that the return part is the day. > I's set value is as follows: YYYY YEAR Year Year Q Quarter M Month Month D Day Day W Weekday Week HOUR Time M Minute Dividers S Second Second D: The date to be calculated. > FW: Set the first day of the week for the week, if it is not set, it is expressed as Sunday. > The setting value of the FW is as follows: 0 Use the> API setting value. 1 Sunday 2 Monday> 3 Tuesday 4 Wednesday 5 Thursday 6 Friday 7 Saturday FY: Set the first week of one year, if it is not set, it means that the week is one year in the first week of one year. > The set value of FY is as follows: 0 Use the> API setting value. January 1st, the first week of one year 2, at least the first week of the first week of the first week, 3 included the first week of seven days, the first week of one year: datepart ("M "," 25-MAR-99 ") Result: 3 Description: Display the monthly part of a date. DateSerial (Year, Month, day) conversion (Year, Month, day) is a date variable. Example: DateSerial (99, 10, 1) Result: 1999/10 / 1DateValue (String or expression of the date) Converts to a date variable state, date from January 1,100 to December 31,9999. Format is MONTH, DAY, AND YEAR or MONTH / DAY / YEAR.

Such as: DecEmber 30, 1999, DEC 30, 1999, 12/30/1999, 12/30/99: DateValue ("January 1,2002") Result: 2002/1 / 1DAY (Date string or expression) The "Japanese" part of the return date. Example: DAY ("12/1/1999") Result: 1FIX (expression) TOP conversion string into an integer digital state. The same as the INT function. Returns NULL if null. INT (NUMBER) and FIX (Number) are negative. Such as int (-5.6) = - 6, FIX (-5.6) = - 5. Example: Fix (5.6) Result: 5HEX (Expression) TOP Retrieve Numerical hexadecimal value. If the expression is NULL, hex (expression) = null, if the expression = EMPTY, HEX (expression) = 0. The 16 carry can be represented by "& H", such as 16 carry & H10 means a decimal 16. Example: HEX (30) Result: 1EUR (Time string or expression) Recycling time "Hours" part. Example: Hour ("12:30:54") Results: 12instr ([Start,] string1, string2 [, compare]) TOP will cause a string from left and another comparison, back the first identical location . START is compared from the first few words. If START omits START, String1 is a string expression to be checked, and string2 is a string expression to be compared, and Compare is a comparison method, compare = 0 Table binary comparison method, Compare = 1 table text comparison method, if the Compare is omitted, it is a preset binary comparison method. Example: INSTR ("ABC123DEF123", "12") Result: 4instrrev ([Start,] string1, string2 [, compare]) Transfer a string from right and left with another comparison, and then back the first identical location. START is compared from the first few words. If START omits START, String1 is a string expression to be checked, and string2 is a string expression to be compared, and Compare is a comparison method, compare = 0 Table binary comparison method, Compare = 1 table text comparison method, if the Compare is omitted, it is a preset binary comparison method. Example: Instrrev ("ABC123DEF123", "12") Result: 10INT (expression) The integer part of a value. The same is the same as the FIX function. Example: INT (5.6) Result: 5isArray (Variable) Test Variable is (true) No (false) is an array. Example: Isarray (3) Result: False Description: Not an array. Isdate (Expression of a date or string) can be converted to a date. Date from January 1,100 A.D. to December 31,9999 A.D. Example: Isdate ("DECEMBER 31, 1999") Result: True Description: You can convert a date.

ISEMPTY test variable is (true) No (false) has been initialized: ISEMPTY (A) Result: TRUEISNULL (Variable) Test variable is (true) No (false) is not valid data. Example: Isnull ("") Result: false Description: It is a valid data. ISNUMERIC is (TRUE) No (false) is a number. Example: ISNUMERIC ("abc123") Result: false Description: Not a number. LCASE (string expressions) TOP conversion strings are lowercase. Convert part of the uppercase letters into lowercase. The rest of the string remains unchanged. Example: LCASE ("abc123") Result: Abc123left (string expression, length) takes a few words on the left side of the string. Length is a word. The LEN function can know the length of the string. Example: Left ("ABC123", 3) Result: Abclen (string expressive variable) obtains the length of the string. Example: LEN ("ABC123") Result: 6Ltrim (string expression) Remove the blank word on the left of the string. RTRIM removes the blank word on the right side of the string, the TRIM function removes the blank word on the left and right sides of the string. Example: LTRIM ("456 " ABC ") Result: 456ABC123MID (string expressions, start [, length]) TOP take a few words in the string. START is taken from the first few words, Length is a few One word, if Length is taken from Start to the far right. The length of the string can be known from the LEN function. Example: MID ("ABC123", 2, 3) Result: C12minute (Date string or expression) The "minute" part of the return time. Example: Minute ("12:30:54") Results: 30Month (String or Expressions) Remove the "Month" part of the date. Example: MONTH ("12/1/2001") Result: 12MonthName (Month [, Abbreviate]) is sent back to the moon. Month: The number of the moon name to be passed to 1 to 12. For example, 1 represents January, 7 represents July. Abbreviate: Yes (false) is abbreviated, such as march, abbreviated as Mar. The default is false. The moon name of Chinese has no zone. Example: MONTHNAME (7) Result: July now () transmission back system date time. Example: NOW () Result: 2001/12/30 10:35:59 Amoct () The eight-entered value of the value. The eight-in position can be represented by "& O", such as an octave & O10 means a decimal 8. Example: OCT (10) Result: 12Replace (string expression, findnreplacewith [, start [, count [, compare]]) replaces a string. Looking for the original string (find), if it is found, it is replaced into a new string (ReplaceWith). Find: Status to look for the replacement of the original string. ReplaceWith: Replace the word. START: From the first few words to find replacement, if it is not set, it is started from the first word. COUNT: The number of substitutions. If it is not set, all the strings that all the strings that are looking for are all replaced.

Compare: Look for comparison methods, compare = 0 represents binary comparison method, compare = 1 table text comparison method, compare = 2 table determines the comparative data type, if the Compare is a preset binary comparison method. Example: Replace ("Abcd123ABC", "AB", "AB") Result: ABCD123ABCRIGHT (string expression, length) takes a few words on the right side of strings, Length is taken a few words. The LEN function can know the length of the string. Example: Right ("ABC123", 3) Result: 123RND [(Number)] 0 ~ 1 Random Random Numeris. Number is any valid numerical expression. If Number is less than 0, the same random random value is obtained each time. Number is greater than 0 or not provided to obtain the next random random value. > Number = 0 Indicates the recently generated random random value. In order to avoid obtaining the same random random number, randomize can be added prior to the RND function. Example: RND Results: 0.498498Round (numerical expression [, d]) rounded. D: For the first time to go to the first decimal decimal, if the omitted is omitted, it is round to the integer. Example: Round (30635, 1) Result: 3.6rtrim (string expression) Remove the blank word on the right side of the string. LTRIM removes the blank word on the left of the string, the Trim function removes the blank word on the left and right sides of the string. Example: RTRIM ("ABC123") "456" Result: ABC123456Second (Time string or expression) TOP back time of "second" part. Example: SECOND ("12:30:54") Result: 54Space (number of repetitions) Gets the same blank string. Example: a " Space (5) " B Results: a b Description: Five blank characters in the middle of A and B. String (Number of repetitions, the word to be repeated) gets the same string. Example: String (5,71) Results: GggggStrreverse (String (10, 71)) reverses a string order. Example: Strreverse ("abc") Result: CBATIME () Remove the time of the system. Example: Time Results: 10:35:59 PmtimeSerial (Hour, Minute, Second) Converts Specifies (Hour, Minute, Second) into a time variable type. Example: TimeSerial (10, 31, 59) Result: 10: 31: 59TimeValue (String or expression of the date) Convert to a time variable. Date string or expression from 0:00:00 (12:00:00 A.m.) to 23:59:59 (11:59:59 p.m.). Example: TimeValue ("11:59:59") Results: 11: 59: 59Trim (string expression) Remove blank characters on the left and right sides of the string. Example: TRIM ("ABC123") Result: Abc123ucase () TOP conversion string is uppercase. Convert the part of the lowercase letter to uppercase, the remaining part of the string constant. Example: UCASE ("ABC123") Result: ABC123VARTYPE (variable) is transmitted back to a variable type.

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

New Post(0)