Download presentation
Presentation is loading. Please wait.
1
Dr. Abraham Professor UTPA
Chapter 17 Strings Dr. Abraham Professor UTPA
2
Topics Array of characters String Class StringBuilder Class
3
Array of Characters Dim characterArray() As Char = New Char(20) {}
characterArray = "This is a test" MessageBox.Show(characterArray & Len(characterArray), "Show Character Array")
4
Showing Each Character
MessageBox.Show("Fifth Character is: " & vbCrLf & characterArray(5), "Fifth Character")
5
Copying Character Array to String
Dim myString As String myString = characterArray MessageBox.Show(myString & Len(myString), "Show String") If myString = characterArray Then MessageBox.Show("Compared both and they are equal", "String comparison")
6
String Class methods Startswith EndsWith For i = 0 To numStrings
If myStrings(i).StartsWith((txtStarts.Text)) Then textBoxOutput += myStrings(i) & vbCrLf End If Next EndsWith Similar
7
String Class methods Locating Characters and Substrings ToUpper
yourString.IndexOf(“LookingFor”,whereTobegin) Will yield index of character where it was found ToUpper ToLower Trim
8
Class StringBuilder It is found in system.text
Mostly used to place data in tabular form. See the example from the program.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.