Get Length of Strings
The String type has a built-in Length property, which returns an integer that represents the number of characters in the string (its length).
Those characters include things like spaces as well as punctuation marks.
For example the string "Hello World!" is not only 10 characters long. Rather its length is 12 because of the empty space and the exclamation mark.
this example demonstrates the Length property:
Those characters include things like spaces as well as punctuation marks.
For example the string "Hello World!" is not only 10 characters long. Rather its length is 12 because of the empty space and the exclamation mark.
this example demonstrates the Length property:
1
2
3
4
| Dim MyString As String = String .Empty MessageBox.Show(MyString.Length) ' = 0 MyString = "Hello World!" MessageBox.Show(MyString.Length) ' = 12 |