1.Find Length of String.
Dim StrLength As String = TextBox1.Text
Dim r As Integer =StrLength .Length
MsgBox("Length is " + r.ToString())
2. Find SubString of a String.
Dim r As String = TextBox1.Text 'Textbox1 Lenght should be 7 Charachers
'r = r.Substring(3)
r = r.Substring(4, 3)
MsgBox("Substring of " + r.ToString())
2. Index of SubString.
Dim r As String = "santosh is happy to help u"
r = r.IndexOf("ap")
MsgBox("Index of " + r.ToString())
4. Search SubString inside a String
Dim s1 As String = TextBox1.Text
Dim s2 As String = TextBox2.text
dim r as integer = TextBox1.Text.IndexOf(TextBox2.Text)
If r > 0 Then
MsgBox("Found word, " & r & " characters into the search string.")
Else
MsgBox("Sorry, could not find the search text")
End If
any doubt plz feel free to ask.
With ragards,
santosh
Dim StrLength As String = TextBox1.Text
Dim r As Integer =StrLength .Length
MsgBox("Length is " + r.ToString())
2. Find SubString of a String.
Dim r As String = TextBox1.Text 'Textbox1 Lenght should be 7 Charachers
'r = r.Substring(3)
r = r.Substring(4, 3)
MsgBox("Substring of " + r.ToString())
2. Index of SubString.
Dim r As String = "santosh is happy to help u"
r = r.IndexOf("ap")
MsgBox("Index of " + r.ToString())
4. Search SubString inside a String
Dim s1 As String = TextBox1.Text
Dim s2 As String = TextBox2.text
dim r as integer = TextBox1.Text.IndexOf(TextBox2.Text)
If r > 0 Then
MsgBox("Found word, " & r & " characters into the search string.")
Else
MsgBox("Sorry, could not find the search text")
End If
any doubt plz feel free to ask.
With ragards,
santosh
No comments:
Post a Comment