VB.Net Tutorial/Data Type/String Replace

Материал из VB Эксперт
Перейти к: навигация, поиск

Replace a sub string with "Replace"

Class Tester
     Shared Sub Main()
        Dim userInput As String
        userInput = "  asdf  "
        Console.WriteLine(Replace(userInput, "f", ""))
     End Sub
End Class
asd

Replace substring with another substring

public class Test
   public Shared Sub Main
               Dim s1 As New String("Greeting")
               s1 = s1.Replace("e", "i")
               Console.WriteLine(s1)
   End Sub
End class
Griiting