String Manipulation

Remove and Insert Functions


Remove function
The Remove function remove characters from a string.
st=str.Remove(start_index,num_chars)
Example:
Module Module1
 
    Sub Main()
        Dim str1 As New String("Hello World")
        Dim str2 As String = str1.Remove(0, 5)’Remove “Hello” from str1
        Console.WriteLine(str2)
        Console.ReadLine()
    End Sub
 
End Module
 


Insert function
The Insert function inserts a string to anther string.
st=Str.Insert(start_index, text)
Example:
Module Module1
 
    Sub Main()
        Dim str1 As New String("HelloWorld")
        Dim str2 As String = str1.Insert(5, " ") 'Insert a white space in index 5 of str1
        Console.WriteLine(str2)
 
 
        Console.ReadLine()
    End Sub
 
End Module


HTML Comment Box is loading comments...



This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.