Download presentation
Presentation is loading. Please wait.
2
The String Class Properties and Methods
3
Chars(index) Method Dim strtest as string, strtwo as string strtest = “peanut butter” Lbldisplay.text = strtest.Chars(4) What is displayed in lbldisplay? u
4
Chars(index) Method Continued Dim strtest as string strtest = “Valentine” Lbldisplay.text = strtest.Chars(2) What is displayed in lbldisplay? l
5
Length Member Dim strtwo as string strtwo = “happy” Lbldisplay.text =strtwo.Length What is displayed in lbldisplay? 5
6
Length Member Continued Dim strlength as string strlength = “Mississippi” Lbldisplay.text =strlength.Length What is displayed in lbldisplay? 11
7
ToUpper Method Dim strword as string strword = “friendship” Lblword.text = strword.ToUpper What is displayed in lblword? FRIENDSHIP
8
ToLower Method Dim strword as string strword = “TeAm WoRK” Lblword.text = strword.ToLower What is displayed in lblword? team work
9
Trim Method Dim strtwo as string strtwo = “ chocolate ” Lbllength.text=strtwo.length Lbldisplay.text = strtwo.Trim Lbllength.text = strtwo.length What is displayed in the labels? chocolate 15 9
10
TrimEnd Method Dim strtwo as string strtwo = “ chocolate ” Lbldisplay.text = strtwo.TrimEnd Lbllength.text=strtwo.length What is displayed in labels? chocolate 12
11
TrimStart Method Dim strtwo as string strtwo = “ chocolate ” Lbldisplay.text = strtwo.TrimStart Lbllength.text=strtwo.length What is displayed in lbldisplay? chocolate 12
12
PadLeft(len, char) Dim strword as string strword = “Success” Lblgd.text =strword.PadLeft(10, “o”) What is displayed in lblgd? oooSuccess
13
PadLeft(len, char) Continued Dim strword as string strword = “Pride” Lblgd.text =strword.PadLeft(5, “w”) What is displayed in lblgd? Pride
14
PadRight(len, char) Dim strword as string strword = “healthy” Lblgd.text =strword.PadRight(12, “s”) What is displayed in lblgd? healthysssss
15
Nested Functions Dim strtest as string, strtwo as string strtest=“folks!” strtwo=“That’s all folks!” Lbldisplay.text = strtest.PadLeft(strtwo.Length,”.”) What is displayed in lbldisplay?...........folks!
16
Nested Functions (continued) Dim strtest as string, strtwo as string Dim N as integer=9 strtest=“stripes” Strtwo=“please” Lbldisplay.text = strtwo.PadRight(N,strtest.Chars(5)) What is displayed in lbldisplay? pleaseeee
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.