Strings can be used as an array of characters in VB.Net; however, when you declare itYou and the String keyword is more commonly used to declare a string variable. The string keyword is an alias for the class System.String.
Create a String Object
You can make a string object by using one of the techniques listed below.
- By putting a string literal into a String variable
- Using the String class's function Object() { [native code] }
- By employing the string concatenation operator (+), you can create a new string.
- By obtaining a property or invoking a method that returns a string
- By invoking a formatting method to transform a value or object to a string representation
Properties of the String Class
The String class has the following two properties −
Sr.No |
Property Name & Description |
1 |
Chars Gets the Char object in the current String object at a specified position. |
2 |
Length Gets the number of characters in the current String object. |
Methods of the String Class
The String class has many methods that help in working with the string objects like
Public Shared Function Compare ( strA As String, strB As String ) As Integer, Public Shared Function Concat ( str0 As String, str1 As String, str2 As String ) As String, Public Function Contains ( value As String ) As Boolean, and many more. A complete list of methods and string class constructors can be obtained from the MSDN library.