ASP Classic function Syntax detailed explanation

Source: Internet
Author: User
Tags abs date array empty expression variables variable trim
Functions | syntax
Abs (numerical) Absolute. The absolute value of a number is its positive value. The absolute value of an empty string (null), also an empty string. Uninitialized variable, which is absolutely 0 Example: ABS (-2000)
Results: 2000
Array (element with comma-delimited arrays) The array function returns the value of an array element. Example:
A=array (1,2,3)
B=a (2)
Results: 2
Description: Variable B is the value of the second element of array A.
ASC (String) Converts the first letter of a string to ANSI (American National standard symbol) codewords. Example: ASC ("Internet")
Results: 73
Description: Displays the ANSI codewords of the first letter I.
CBool(expression) Convert to Boolean logical value variable type (TRUE or FALSE) Example: CBool (1+2)
Result: True
CDate (date expression) Change to date variable type. You can use the IsDate function to determine whether a date could be converted. Example: CDate (now () +2)
Results: 2000/5/28 10:30:59
CDbl(expression) Converts to a double variable type.  
Chr (ANSI codewords) Converts an ASCII codewords into a character. Example: Chr (72)
Result: H
CInt (expression) Converted to an integer variable type. Example: CInt ("3.12")
Results: 3
CLng (expression) Converted to a long variable type.  
CSng (expression) into a single variable type.  
CStr (expression) Converts to a string variable type.  
Date () The date the system was passed back. Example: Date
Results: 2000/5/13
DateAdd (I, N, D) Add a date to the date after the period. I: Set the unit for a period of time (date). For example, interval= "D" means the unit of n is the day. The setting value of I is as follows:
YYYY year
Q Quarter Season
M Month Month
D Day
W Weekday Week
H Hour Time
N-Minute
S Second sec
N: A numeric expression that sets a period of time added by a date, either positive or negative, positive (the result is >date date), and negative for minus (the result is >date previous date).
D: The date to be added and reduced.
Example: DateAdd ("M", 1, "31-jan-98")
Result: 28-feb-98
Note: Add the date 31-jan-98 one months, the result is 28-feb-98 rather than 31-fe-98.
Example: DateAdd ("D", "30-jan-99")
Results: 1999/2/9
Description: Add a date 30-jan-99 20 days after the date.
datediff (I, D1, D2[,fw[,fy]]) Calculates the period between two dates.
I: Sets the unit of period calculation between two dates. For example, >i= "m" means the unit of calculation is month. >i set values such as:
yyyy > Year
Q Quarter quarter
M Month month
D Day
W weekday week
H Hour when
M Minute Br>s Second seconds
D1, D2: Two-date expressions in the calculation period, if the >date1 is earlier, the period result between two dates is positive, and if the >date2 is earlier, the result is negative.
FW: Sets the first day of the week for the week, if not set for Sunday. The setting value of the >FW is as follows:
0 uses the set value of >api.
1 days
2 weeks one
3 Tuesday
4 week three
5 Thursday
6 Friday
7 Saturday
FY: Set the first week of the year, if not set, the week of January 1 is the first week of the year. The setting value of the >fy is as follows:
0 uses the set value of >api.
1 January 1 that week is the first week of the year
2 includes at least four days first week for the first week of the year
3 includes seven days first week for the first week of the year
> example: DateDiff ("D", "25-mar-99", "30-jun-99")
Results:
Description: Displays a period of 97 days between two dates.
datepart (i,d,[,fw[,fy)]) >i: Setting returns that part. For example, >i= "D" means to return part of the day. The >i values are set as follows:
yyyy year
Q quarter quarter
M Month month
D Day
W weekday week
H Hour when
m Minute cent
S Second seconds
D: the date to be calculated.
>FW: Set the first day of the week as a weekday, or Sunday if not set. The setting value of the >FW is as follows:
0 uses the set value of >api.
1 days
2 week >3 Tuesday
4 week three
5 Thursday
6 Friday
7 Saturday
FY: Set the first week of the year, if not set, the week of January 1 is the first week of the year. The setting value of the >fy is as follows:
0 uses the set value of >api.
1 January 1 that week is the first week of the year
2 includes at least four days first week for the first week of the year
3 includes seven days first week for the first week of the year
> example: DatePart ("M", "25-mar-99")
Result: 3
Description: Displays the month portion of a date returned.
Dateserial (Year,month,day) Transform (Year,month,day) into a date variable type. Example: DateSerial (99,10,1)
Results: 1999/10/1
DateValue (A string or an expression of a date) Convert to date variable form, dated from January 1,100 to December 31,9999. The format is Month,day,and year or month/day/year. For example: December 30,1999, Dec 30,1999, 12/30/1999, 12/30/99 Example: DateValue ("January 1,2002")
Results: 2002/1/1
Day (A string or an expression of a date) Returns the "Day" part of the date. Example: Day ("12/1/1999")
Results: 1
Fix (expression) Converts strings into integer numeric patterns. Same as Int function. NULL is returned if NULL.
The difference between Int (number) and Fix (number) is negative. such as Int ( -5.6) =-6, Fix (-5.6) =-5.
Example: Fix (5.6)
Results: 5
Hex (expression) Returns the hexadecimal value of a value. If the expression is null Hex (expression) =null, if the expression =empty Hex (expression) = 0. The 16 carry can be added "&h", for example, the 16 carry &H10 represents the decimal 16. Example: Hex (30)
Results: 1E
Hour (A string or expression of time) Returns the "hour" part of the time. Example: Hour ("12:30:54")
Results: 12
InStr ([Start,]string1,string2[,compare]) Compares a string from left to right with the other and returns to the same position as the first.
Start is a comparison from the first word, if the start is omitted from the beginning of the comparison, string1 for the string expression to be found, string2 for the string expression to be compared, compare for comparison, compare=0 table binary comparison method, compare =1 Table Text comparison method, if omitted compare is a preset binary comparison method.
Example: InStr ("abc123def123", "12")
Results: 4
InStrRev ([Start,]string1,string2[,compare]) Returns a string from the right and left to the other, returning to the first same position.
Start is a comparison from the first word, if the start is omitted from the beginning of the comparison, string1 for the string expression to be found, string2 for the string expression to be compared, compare for comparison, compare=0 table binary comparison method, compare =1 Table Text comparison method, if omitted compare is a preset binary comparison method.
Example: InStrRev ("abc123def123", "12")
Results: 10
Int (expression) Returns the integer portion of a number. Same as the Fix function. Example: Int (5.6)
Results: 5
IsArray Variables The test variable is (True) No (False) is an array. Example: IsArray (3)
Result: False
Description: Not an array.
IsDate (An expression of a date or string) Whether it 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: Can be converted to date.
IsEmpty Variables The test variable is (True) No (False) has been initialized Example: IsEmpty (a)
Result: True
IsNull Variables The test variable is (True) No (False) is not a valid data. Example: IsNull ("")
Result: False
Description: is valid data.
IsNumeric (expression) Is (True) No (False) is a number. Example: IsNumeric ("abc123")
Result: False
Description: Not a number.
LCase (string expression) The conversion string is lowercase. Converts a portion of a capital letter to lowercase. The remaining parts of the string are unchanged. Example: LCase ("ABC123")
Result: abc123
Left (string expression, length) Takes a few words to the left of the string. Length is a word. The Len function is able to learn the length of the string. Example: Left ("ABC123", 3)
Result: ABC
Len (String expression variable) Gets the length of the string. Example: Len ("ABC123")
Results: 6
LTrim (string expression) Remove the blank word to the left of the string. RTrim removes the blank word on the right side of the string, and the Trim function drops the whitespace on both sides of the string. Example: LTrim ("456+", "abc")
Result: 456abc123
Mid (string expression, Start[,length]) Takes a few words from the string. Start is taken from the first few words, length to take a few words, if slightly length from start to the bottom right. The Len function allows you to know the length of the string. Example: Mid ("abc123", 2, 3)
Result: C12
Minute (A string or an expression of a date) Returns the "minute" part of the time. Example: Minute ("12:30:54")
Results: 30
Month (A string or an expression of a date) Returns the "month" part of the date. Example: Month ("12/1/2001")
Results: 12
MonthName (Month[,abbreviate]) Returns the name of the month.
Month: The number 1~12 the name of the month to be returned. For example, 1 represents January, and 7 represents July.
Abbreviate: Yes (True) (False) is abbreviated, for example, March, abbreviated as Mar. The default value is False. The name of the month in Chinese is not abbreviated.
Example: MonthName (7)
Results: July
Now () Returns the date and time of the system. Example: Now ()
Results: 2001/12/30 10:35:59 AM
Oct () Returns the octet value of a value. Octal can be added to "&o", for example, the octal &o10 represents 8 of the decimal. Example: Oct (10)
Results: 12
Replace (string expression, Findnreplacewith[,start[,count[,compare]]) Replaces a partial word with a string. Find the original string to be replaced (find) and replace it with the new string (replacewith) if found.
Find: The original string to be looked for instead.
ReplaceWith: Replace the word after.
Start: Look for the substitution from the first few words, if not set, then start looking for a word.
Count: Number of replacements. If not set, all the found strings are replaced by the string.
Compare: Looking for the comparison method, compare=0 represents the binary comparison method, Compare=1 table text comparison method, compare =2 table According to the comparison data type, if omitted compare is the preset binary comparison method.
Example: Replace ("ABCD123ABC", "AB", "AB")
Result: ABCD123ABC
Right (string expression, length) Take a few words to the right of the string, and length to take a few words. The Len function is able to learn the length of the string. Example: Right ("ABC123", 3)
Results: 123
Rnd [(number)] Random random value of 0~1. Number is any valid numeric expression. A number less than 0 indicates that the same random random value is obtained each time. If number is greater than 0 or not provided, the next random random value is given sequentially. >number=0 represents the most recently generated random random value. In order to avoid the same random sequence of random numbers, we can add Randomize to the Rnd function. Example: Rnd
Results: 0.498498
Round (Numeric expression [, D]) Rounded.
D: Rounded to the decimal number, or rounded to an integer if omitted.
Example: Round (30635,1)
Results: 3.6
RTrim (string expression) Remove the blank word to the right of the string. LTrim to remove the blank word on the left side of the string, the Trim function drops the whitespace on both sides of the string. Example: RTrim ("abc123") + "456"
Result: abc123456
Second (A string or expression of time) Returns the "seconds" portion of the time. Example: Second ("12:30:54")
Results: 54
MySpace (Number of repetitions) Gets the same blank string that repeats. Example: A "+space" (5) + "B"
Result: A B
Description: Add five blank words between A and B.
String (repetition times, words to repeat) Get repeated the same string. Example: String (5,71)
Result: GGGGG
StrReverse (String (10,71)) Reverses the order of a string. Example: StrReverse ("ABC")
Results: CBA
Time () The time that the system was passed back. Example: Time
Result: 10:35:59 PM
timeserial (Hour,minute,second) Converts the specified (Hour,minute,second) into a time variable type. Example: TimeSerial (10,31,59)
Result: 10:31:59
TimeValue (A string or an expression of a date) Convert to time variable type. The string or expression of the date from 0:00:00 (12:00:00 a.m.) to 23:59:59 (11:59:59 p.m.). Example: TimeValue ("11:59:59")
Result: 11:59:59
Trim (string expression) Remove the blank words on both sides of the string. Example: Trim ("abc123")
Result: abc123
UCase () Capitalize the converted string. Converts a portion of a lowercase letter to uppercase and the rest of the string unchanged. Example: UCase ("abc123")
Result: ABC123
VarType Variables Returns a variable type. As with the TypeName function, VarType returns the code of the variable type, TYPENAME returns the name of the variable type. Example: VarType ("I Love you!")
Results: 8
Weekday (Date expression, [FW]) Returns the number of the day of the week.
FW: Set the first day of the week is the week. If omitted, table 1 (Sunday).
Firstdayfweek setting values are: 1 (Sunday), 2 (Monday), 3 (Tuesday), 4 (Wednesday), 5 (Thursday), 6 (Friday), 7 (Saturday).
Example: Weekday ("1/1/2000")
Results: 7
WeekdayName (W,A,FW) Returns the name of the day of the week.
W: Is (True) No (False) abbreviation. For example, March, the abbreviation for the Mar. Default to False. The name of the week in Chinese is not abbreviated.
FW: Set the first day of the week is the week. If Table 1 (Sunday) is omitted. Sets the name of the day of the week to be returned, which is the first days of the week.
A:1 (Sunday), 2 (Monday), 3 (Tuesday), 4 (Wednesday), 5 (Thursday), 6 (Friday), 7 (Saturday).
Example: WeekdayName ("1/1/2000")
Results: Saturday
Year () Returns the "year" part of the date. Example: Year ("12/1/2000")
Results: 2000


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.