vb Basics

A relational operators
effect: to compare the size of the two operands, the result is true or False.
Operator: <,> =, <, <=, =, <> same priority
comparison rule: from left to right one of the two strings by character comparison value encoding, as long as the end of a different pair comparison.
Example: "" code value 32; "0" code value 48; "A" code value 65; "a" code value 97.
"ABCDE"> "aBcderfg" Results: True
"123456"> "98" Results: False

Second, logical operators
effect: Is the logic operation operand, the result is a logical value, True or False. The operands can be numerical expressions, characters, relations to nonzero is True, False zero logic operation
** main operator: ** Not (non) And (with) or (or)
of the same priority: high low
Not unary, negated
And two operands as long as the result is one of only is True True, False otherwise
or two hours of operation as long as one is True, result is True; False when the two are, False results only for the
example: x represents a numerical range for a period of: 10 <= x <= 20
logical expression of Vb: 10 <= x <= 20 ( error) 10 <= x And x < = 20 ( correct)
* Note: * 10 <= x <= 20 VB is determined to be 10 <= x (the result is True or False), then the result of the comparison and then <= 20, and because True = -1, False = 0, so that both the foregoing the result is True or False, they are the result of the comparison will be True.
Expression:
Composition: variables, constants, functions, operators, and parentheses
writing rules:
1. The operator can not adjacent: a + -b wrong
2. The multiplication sign can not be omitted: x multiplied by y, should be written: * the y-the X-
3. brackets must appear in pairs (both parentheses)
the right to write:

example: outstanding student selection criteria: Age (Age) less than 19 years old, three courses total score (Total) higher than 285 points, including a 100 points, the expression?
Age <19 And Total> 285 And Mark1 = 100 or Mark2 = 100 or Mark3 = 100
different types of data conversion:
data type operation result closer to the high precision data type
Integer

Third, the commonly used internal function:
Definition: predefined system functions for users to call
Category: mathematical functions, conversion functions, string functions, date functions, other functions such as
forms: function name (parameter list)
commonly used mathematical functions:

commonly used transfer function:

Description:
Chr Asc function and mutually inverse function:
= "R & lt" Chr (Asc ( "R & lt"))
Str function to convert the values to a character type, if the value is positive, the character string after conversion left add a space.
STR (123.45) = "U123.45"
Val digital string into a numeric, non-numeric occurs when the string, conversion is stopped, the function returns the result of conversion before stopping.
Val ( "- 123.45ty3") = - 123.45

Used string functions:

Example:
String (. 5, "A") = "AAAAA"
the Instr ( "AEFABCDEFG", "EF") 2 =
Mid ( "ABCDE", 2,3) = "the BCD"
Mid ( "AB China 123 ", 2,6) =" B China 123 "
Trim (" UUUABCUUU ") =" the ABC "
Left (" ABCDE ", 2) =" AB "

Date function:
NoW returns the system date and time
Year (D) Returns the date in year
DareAdd (to increase or decrease the date form, the amount of increase or decrease to increase or decrease the variable date)
the DateDiff (an interval of the date, a date, date 2 )
---------------------
Disclaimer: This article is CSDN blogger "Jason Wang Huachun a" original article, follow the CC 4.0 by-sa copyright agreement, reproduced attach the original source link and this statement.
Original link: https: //blog.csdn.net/whc888666/article/details/80658113

Guess you like

Origin www.cnblogs.com/zhaoxiangyu/p/11318052.html