Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is a VBScript function

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "what is VBScript function". In daily operation, I believe that many people have doubts about what is VBScript function. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what is VBScript function"! Next, please follow the editor to study!

VBScript function

Function description

Exampl

Abs (numeric) absolute value. The absolute value of a number is its positive value. The absolute value of an empty string (null) is also an empty string. Uninitialized variable, which is absolutely zero example: ABS (- 2000)

Results: 2000

The Array (array elements separated by commas) the Array function returns the value of the array elements. Example:

A=Array (1, 2, 3)

Batha (2)

Results: 2

Description: variable B is the value of the second element of the An array.

Asc (string) converts the first letter of a string into an ANSI (American National Standard symbol) code. Example: Asc (Internet ")

Results: 73

Description: displays the ANSI code of the first letter I.

Conversion of CBool (expression) to Boolean logical value variable type (True or False) example: CBool (1x2)

Results: True

CDate (date expression) is replaced with a date variable type. You can first use the IsDate function to determine whether it can be converted to a daily period. Example: CDate (now () + 2)

Result: 10:30:59 on 2000-5-28

CDbl (expression) is converted to the DOUBLE variable type.

Chr (ANSI code) converts ASCII codes into characters. Example: Chr (72)

Results: h

CInt (expression) is converted to an integer variable type. Example: CInt ("3.12")

Results: 3

CLng (expression) is converted to the LONG variable type.

CSng (expression) is converted to the SINGLE variable type.

CStr (expression) is converted to a string variable type.

Date () top returns the date of the system. Example: Date

Result: 2000-5-13

DateAdd (I, N, D) adds a date to the date after a period. I: the unit of a period added to a date (Date). For example, interval= "d" means that the unit of N is the day. The setting value of I is as follows:

Yyyy Year year

Q Quarter season

M Month month

D Day Day

W Weekday week

H Hour

N Minute score

S Second seconds

N: a numeric expression that sets the period to which a date is added, either positive or negative, with a positive value indicating addition (the result is a date after > date) and a negative value indicating subtraction (the result is a date before > date).

D: date to be added or subtracted. Example: DateAdd ("m", 1, "31-Jan-98")

Results: 28-Feb-98

Description: add the date 31-Jan-98 to one month, and the result is 28-Feb-98 instead of 31-Fe-98.

Example: DateAdd ("d", 20, "30-Jan-99")

Result: 1999-2-9

Description: add a date 30-Jan-99 to a date 20 days later.

DateDiff (I, D1, D2 [, FW [, FY]]) calculates the period between two dates.

I: sets the unit of calculation for the period between two dates. For example, > I = "m" indicates that the unit of calculation is month. > the set values of I are as follows:

Yyyy > Year year

Q Quarter season

M Month month

D Day Day

W Weekday week

H Hour

M Minute score

S Second seconds

D1, D2: two date expressions for the calculation period. If > date1 is earlier, the result of the period between two dates is positive; if > date2 is earlier, the result is negative.

FW: sets the first day of the week as the day of the week, if it is not set as Sunday. > the set values of FW are as follows:

0 uses the set value of > API.

1 Sunday

2 Monday

3 Tuesdays

4 Wednesday

5 Thursday

6 Friday

7 Saturdays

FY: set the first week of the year. If not, it means that the week of January 1st is the first week of the year. > the set values of FY are as follows:

0 uses the set value of > API.

The week of January 1st is the first week of the year

2 the first week including at least four days is the first week of the year

3 examples of the first week of the year including seven days: DateDiff ("d", "25-Mar-99", "30-Jun-99")

Results: 97

Description: shows that the period between two dates is 97 days.

DatePart (iPermine D, [, FW [, FY]]) returns the part of a date.

> I: set which part to return. For example, > I = "d" indicates that the returned part is day. > the set value of I is as follows:

Yyyy Year year

Q Quarter season

M Month month

D Day Day

W Weekday week

H Hour

M Minute score

S Second seconds

D: date to be calculated.

> FW: set the first day of the week as the day of the week, or Sunday if it is not set. > the set values of FW are as follows:

0 uses the set value of > API.

1 Sunday

2 Monday > 3 Tuesday

4 Wednesday

5 Thursday

6 Friday

7 Saturdays

FY: set the first week of the year. If not, it means that the week of January 1st is the first week of the year. > the set values of FY are as follows:

0 uses the set value of > API.

The week of January 1st is the first week of the year

2 the first week including at least four days is the first week of the year

3 including the first week of seven days is the first week of the year example: DatePart ("m", "25-Mar-99")

Results: 3

Description: displays the month portion of a date returned.

Dateserial (year,month,day) converts (year,month,day) to a date variable type. Example: DateSerial (999910pm 1)

Result: 1999-10-1

DateValue (a string or expression of a date) is converted to a date variable type, with dates from January 1100 to December 31. The format is month,day,and year or month/day/year. For example, December 30je 1999, Dec 30je 1999, 12max 30max 1999, 12-30-99 example: DateValue ("January 1Jue 2002")

Result: 2002-1-1

Day (a string or expression of a date) returns the "day" part of the date. Example: Day ("12 Compact 1 Compact 1999")

Results: 1

Fix (expression) top converts strings to integer numeric types. Same as the Int function. Returns null if it is null.

The difference between Int (number) and Fix (number) is negative. For example, Int (- 5.6) =-6, Fix (- 5.6) =-5. Example: Fix (5.6)

Results: 5

Hex (expression) top returns the hexadecimal value of the numeric value. If the expression is null, Hex (expression) = null, if the expression = Empty, Hex (expression) = 0. Hexadecimal can be expressed by "& H", for example, hexadecimal & H10 represents decimal 16. Example: Hex (30)

Results: 1E

Hour (string or expression of time) returns the "hour" portion of time. Example: Hour ("12:30:54")

Results: 12

InStr ([start,] string1,string2 [, compare]) top compares a string from left to right with another and returns the first to the same position.

Start starts from the first word comparison, if start is omitted, string1 is the string expression to be found, string2 is the string expression to be compared, compare is the comparison method, compare=0 table binary comparison method, compare=1 table text comparison method, if compare is omitted, it is the preset binary comparison method. Example: InStr ("abc123def123", "12")

Results: 4

InstrRev ([start,] string1,string2 [, compare]) compares a string from right to left with another, and returns the first to the same position.

Start starts from the first word comparison, if start is omitted, string1 is the string expression to be found, string2 is the string expression to be compared, compare is the comparison method, compare=0 table binary comparison method, compare=1 table text comparison method, if compare is omitted, it is the preset binary comparison method. Example: InstrRev ("abc123def123", "12")

Results: 10

Int (expression) returns the integer portion of a value. Same as the Fix function. Example: Int (5.6)

Results: 5

IsArray (variable) Test variable is (True) No (False) is an array. Example: IsArray (3)

Results: False

Description: not an array.

Whether IsDate (the expression of a date or string) can be converted to a date. Date from January 1100 A.D. Go to December 31. 9999 A.D. Example: IsDate ("December 31jue 1999")

Results: True

Description: can be converted to a date.

IsEmpty (variable) Test variable is (True) No (False) has been initialized example: IsEmpty (a)

Results: True

IsNull (variable) Test variable is (True) whether (False) is not valid data. Example: IsNull ("")

Results: False

Description: it is valid data.

IsNumeric (expression) Yes (True) No (False) is a number. Example: IsNumeric ("abc123")

Results: False

Description: not a number.

LCase (string expression) top converts strings to lowercase. Convert parts of uppercase letters to lowercase. The rest of the string remains the same. Example: LCase ("ABC123")

Results: abc123

Left (string expression, length) takes a few words to the left of the string. Length takes a word. The Len function knows the length of the string. Example: Left ("ABC123", 3)

Results: ABC

Len (string expression variable) gets the length of the string. Example: Len ("ABC123")

Results: 6

LTrim (string expression) removes the blank words to the left of the string. RTrim removes the white space on the right side of the string, and the Trim function removes the white space on the left and right sides of the string. Example: LTrim ("456 +" abc ")

Results: 456abc123

Mid (string expression, start [, length]) top takes a few words from the string. Start takes a few words from which word, length takes a few words, if slightly length, it takes the rightmost bottom from start. The length of the string is known from the Len function. Example: Mid ("abc123", 2pm 3)

Results: c12

Minute (a string or expression of a date) returns the "minute" portion of the time. Example: Minute ("12:30:54")

Results: 30

Month (a string or expression of a date) returns the month portion of the date. Example: Month ("12Compact 2001")

Results: 12

MonthName (month [, abbreviate]) returns the name of the month.

Month: the number 1-12 of the month name to be returned. For example, 1 represents January and 7 represents July.

Abbreviate: yes (True) No (False) is an acronym, such as March, abbreviated to Mar. The default is False. The Chinese name of the month has no acronym. Example: MonthName (7)

Result: July

Now () returns the date and time of the system. Example: Now ()

Result: 10:35:59 AM on 2001-12-30

Oct () returns the octal value of the value. Octal can be represented by "& O", for example, octal & O10 represents 8 of the decimal system. Example: Oct (10)

Results: 12

Replace (string expression, findnreplacewith [, start [, count [, compare]) replaces part of the word with a string. Look for the original string (find) to be replaced, and if found, it will be replaced with the new string (replacewith).

Find: the original string to be replaced.

Replacewith: superseded word.

Start: start looking for replacement in the first word, or the first word if it is not set.

Count: the number of replacements. If it is not set, all found string replacement strings are replaced.

Compare: find a way to compare. Compare=0 represents binary comparison, compare=1 text comparison, compare= 2 depending on the type of data you compare, if omitted

Compare is the default binary comparison method. Example: Replace ("ABCD123ABC", "AB", "ab")

Results: abCD123abC

Right (string expression, length) takes a few words on the right side of the string, and length takes a few words. The Len function knows the length of the string. Example: Right ("ABC123", 3)

Results: 123

The random random value of Rnd [(number)] 0x1. Number is any valid numeric expression. If number is less than 0, you will get the same random value every time. When number is greater than 0 or is not provided, the next random value is obtained in order. > number=0 means to get the recently generated random values. In order to avoid getting the same random number order, we can add Randomize before the Rnd function. Example: Rnd

Results: 0.498498

Round (numeric expression [, D]) is rounded.

D: to which decimal place is rounded, or to an integer if omitted. Example: Round (30635pi 1)

Result: 3.6

RTrim (string expression) removes the blank words to the right of the string. LTrim removes the white space on the left side of the string, and the Trim function removes the white space on the left and right sides of the string. Example: RTrim ("abc123") + "456"

Results: abc123456

Second (string or expression of time) top returns the "second" portion of time. Example: Second ("12:30:54")

Results: 54

Space (number of repeats) gets a blank string that repeats the same. Example: a "+ Space (5) +" B

Results: a B

Note: add five blank words between An and B.

String (the number of repeats, the word to be repeated) gets the same string that is repeated. Example: String (5pl 71)

Results: GGGGG

StrReverse (String (10ju 71)) reverses the order of a string. Example: StrReverse ("ABC")

Results: CBA

Time () returns the time of the system. Example: Time

Result: 10:35:59 PM

TimeSerial (hour,minute,second) converts the specified (hour,minute,second) to a time variable type. Example: TimeSerial (10, 31, 51, 59)

Result: 10:31:59

TimeValue (a string or expression of a date) is converted to a time variable type. A string or expression for the date from 0:00:00 (12:00:00 A.M.) At 23:59:59 (11:59:59 P.M.). Example: TimeValue ("11:59:59")

Result: 11:59:59

Trim (string expression) removes the blank words on the left and right sides of the string. Example: Trim ("abc123")

Results: abc123

UCase () top converts strings to uppercase. Convert parts of lowercase letters to uppercase, leaving the rest of the string unchanged. Example: UCase ("abc123")

Results: ABC123

VarType (variable) returns a variable type. Like the TypeName function, VarType returns the code for the variable type, and TypeName returns the name of the variable type. Example: VarType ("I love you!")

Results: 8

Weekday (date expression, [FW]) returns the number of days of the week.

FW: set the day of the week as the first day of the week. If omitted, Table 1 (Sunday).

Firstdayfweek settings are: 1 (Sunday), 2 (Monday), 3 (Tuesday), 4 (Wednesday), 5 (Thursday), 6 (Friday), 7 (Saturday). Example: Weekday ("1Compact 2000")

Results: 7

WeekDayName (WMaga Magi FW) returns the name of the day of the week.

W: yes (True) No (False) is an abbreviation. March, for example, is abbreviated to Mar. The default is False. There is no abbreviation for the day of the week in Chinese.

FW: set the day of the week as the first day of the week. If Table 1 (Sunday) is omitted. Set the name of the day of the week to be returned as the day of the week.

A: 1 (Sunday), 2 (Monday), 3 (Tuesday), 4 (Wednesday), 5 (Thursday), 6 (Friday), 7 (Saturday). Example: WeekDayName ("1Compact 2000")

Result: Saturday

Year () returns the "year" portion of the date. Example: Year ("12 Compact 1Compact 2000")

Results: 2000

At this point, the study of "what is the VBScript function" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report