Download presentation
Presentation is loading. Please wait.
Published byGordon Young Modified over 6 years ago
1
VB Math All of your favorite mathematical operators are available in VB: + Addition - Subtraction * Multiplication / Division \ Integer Division Mod Modulo (remainder after integer division) ^ Exponentiation
2
Other Math Functions Trig functions, logarithms, and other advanced math functions are available in the Math class (built in to VB). To use these, just type the word “Math” followed by a period into your code; all of your options will appear in the intellisense drop-down list.
3
String Operator VB strings are powerful and easy to use.
A string variable can hold extremely long strings (millions of characters). The basic string operator is the ampersand (&). It concatenates (puts together) two strings: Dim s As String = “Go “ Dim t As String = “Blue!” Dim u As String = s & t u will have the value “Go Blue!”
4
String Functions VB.NET offers many useful string functions
Most can be accessed simply by typing a period after a string variable:
5
String Functions Some of the most useful string functions are:
Length: how many characters in the string Contains: Boolean indicating if one string is inside another IndexOf: If one string is inside another, this tells you where it begins StartsWith, EndsWith: Boolean indicating whether one string begins or ends with another Insert, Remove, Replace: Common editing functions Substring: Pulls out a part of a string starting with a given character Split: Takes a string and creates an array of strings which are the original string divided up at a given character (like spaces for words or periods for sentences). ToUpper, ToLower: Converts the string’s case.
6
Shortcut assignment operators
VB.NET supports shortcut operators (+=, -=, *=, /=, &=, etc.): A += B is the same as A = A + B X *= 4 is the same as X = X * 4 S &= “!” is the same as S = S & “!”
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.