Kasutaja:M2s17/RefVBDOTNET8
Operators muuda
Arithmetic and concatenation operators muuda
^ - Raises the first number power by another number muuda
* - Multiplies two numbers muuda
/ - Divides two numbers, and returns a floating point result muuda
\ - Divides two numbers, and returns an integer result muuda
% - Divides two numbers, and returns the remainder muuda
Mod - Divides two numbers, and returns the remainder muuda
+ - Adds two numbers muuda
+ - Concatenate two strings muuda
& - Concatenate two expressions as string muuda
- - Gives negative value to a number muuda
- - Between 2 numbers: gives negative value to a second number and adds two numbers muuda
Comparison Operators muuda
< - Less than comparison between 2 expressions muuda
- true, if first expression is smaller than the second expression
- false, if first expression is greater than or equal to the second expression
<= - Less than or equal to comparison between 2 expressions muuda
- true, if first expression is smaller than or equal to the second expression
- false, if first expression is greater than the second expression
> - Greater than comparison between 2 expressions muuda
- true, if first expression is greater than the second expression
- false, if first expression is smaller than or equal to the second expression
>= - Greater than or equal to comparison between 2 expressions muuda
- true, if first expression is greater than or equal to the second expression
- false, if first expression is smaller than the second expression
<> - inequality comparison between 2 expressions muuda
- true, if first expression differs from the second expression
- false, on all other cases
= - equality comparison between 2 expressions muuda
- true, if first expression value is the same as the second expression value
- false, on all other cases
Is - object reference comparison muuda
- true, if the objects reference to the same object
- false, on all other cases
IsNot - object reference comparison muuda
- false, if the objects reference to the same object
- true, on all other cases
TypeOf...Is - object variable comparison with a data type muuda
- true, if thy are the same
- false, on all other cases
Like - string comparison with pattern muuda
- true, if pattern exist
- false, on all other cases
Logical Operators muuda
NOT - (boolean)performs logical negation muuda
- true, if condition is false
- false, if condition is true
AND - (boolean)Performs a logical conjunction muuda
- true, if both conditions are equal
- false, on all other cases
ANDALSO - (boolean)short circuited AND muuda
- true, if both conditions are equal
- false, on all other cases
note : if the first expression is false, the other expression will never be evaluated
Or - (boolean)performs logical disjunction muuda
- true, if at least of of the expressions is true
- false, if both expressions are false
OrAlso - (boolean)short circuited OR muuda
- true, if at least of of the expressions is true
- false, if both expressions are false
note : if the first expression is true, the other expression will never be evaluated
Xor - (boolean)performs logical disjunction muuda
- true, if expression differ
- false, if expression are equal(both true or both false)
IsFalse; IsTrue - Determines expression boolean value muuda
note: you can not define only 1 of them, thy are a logical pair, and must be both declared if any
In addition muuda
- if you use operators on numeric values rather then boolean, bitwise operation will be preformed
- reminder:
- a imp b = (not a) or b
- a eqw b = not (a xor b)
Bit Shift Operators (pattern << amount) muuda
<< - Performs an arithmetic left shift, times amount, on a bit pattern muuda
>> - Performs an arithmetic right shift, times amount, on a bit pattern muuda
Other muuda
GetType - Returns a Type object muuda
AddressOf - Creates a procedure delegate instance that references the specific procedure muuda
How To muuda
String Manipulation muuda
How To create string consisting of the specified number of spaces? muuda
Dim specified_number as Byte = 4
Dim Test As String = Space(10)
Dim specified_number as Byte = 4
Dim Test As String = New String(" ", specified_number)
How To convert string to a number, type double? muuda
Dim Test_string As String = "123.456"
Dim Test_double As Double = Ctype(Val(Test_string), double)
How To determine the length of a number in characters? muuda
Dim Test As Integer = (123.456).ToString.Length
How To determine a possibly valid email? muuda
Public Shared Function IsEmail(ByVal Email As String) As Boolean
Dim re As New Regex("^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")
If re.IsMatch(Email) Then Return True Else Return False
End Function