Combine Insert and IndexOf : String Search « Data Types « VB.Net






Combine Insert and IndexOf

Combine Insert and IndexOf
   
Imports System
Imports System.Collections

Public Class MainClass
    
    Shared Sub Main()
             Dim s1 As String = "abcd"
             Dim s2 As String = "ABCD"
             Dim s3 As String = "Liberty Associates, Inc. provides "
             s3 = s3 & "custom .NET development"

             Dim s5 As String = String.Copy(s2)
             Console.WriteLine("s5 copied from s2: {0}", s5)


             Dim location As Integer = s3.IndexOf("provides")

             ' you can combine the two as follows:
             Dim s11 As String = _
                 s3.Insert(s3.IndexOf("provides"), "usually ")
             Console.WriteLine("s11: {0}", s11)
   End Sub

End Class


           
         
    
    
  








Related examples in the same category

1.Using String searching methods: IndexOfUsing String searching methods: IndexOf
2.LastIndexOf to find a character in a stringLastIndexOf to find a character in a string
3.IndexOf to locate a substring in a stringIndexOf to locate a substring in a string
4.LastIndexOf to find a substring in a stringLastIndexOf to find a substring in a string
5.IndexOfAny to find first occurrence of character in arrayIndexOfAny to find first occurrence of character in array
6.LastIndexOfAny to find first occurrence of character in arrayLastIndexOfAny to find first occurrence of character in array
7.String IndexOf and InsertString IndexOf and Insert
8.String: Substring, LastIndexOfString: Substring, LastIndexOf
9.String IndexOf and Insert at a positionString IndexOf and Insert at a position
10.Sample for String.LastIndexOfAny(Char[])
11.Search string with IndexOf
12.String.LastIndexOfAny Method (Char[])