String IndexOf and Insert
Imports System
Imports System.Collections
Public Class MainClass
Shared Sub Main(ByVal args As String())
Dim s1 As String = "abcd"
Dim s2 As String = "ABCD"
Dim s3 As String = "S3"
s3 = s3 & "Tail"
Dim s5 As String = String.Copy(s2) '
Console.WriteLine("s5 copied from s2: {0}", s5)
Console.WriteLine("String s3 is {0} characters long. ", _
s5.Length)
Console.WriteLine( )
Console.WriteLine("s3: {0}", s3)
Console.WriteLine("s3: ends with 3?: {0}", s3.EndsWith("3"))
Console.WriteLine( )
Console.Write("The first occurrence of 3 ")
Console.WriteLine("in s3 is {0}", s3.IndexOf("3"))
Dim location As Integer = s3.IndexOf("3")
Dim s10 As String = s3.Insert(location, "3")
Console.WriteLine("s10: {0}", s10)
Console.WriteLine( )
End Sub
End Class
Related examples in the same category