Como: remover partes de uma sequência de caracteres (Visual Basic)

The following code example removes all occurrences of one string from another string.

Exemplo

This example uses the Replace function to replace each occurrence of the substring with an empty string. The result is a new string with the substrings removed.

The example assigns the return value of the Replace function to the string variable withoutParts. The original string, stored in withParts, is not changed.

Dim withParts As String = "Books and Chapters and Pages"
Dim withoutParts As String = Replace(withParts, "and ", "")

Compilando o código

Replace "Books and Chapters and Pages" with the string you want to manipulate.

Consulte também

Referência

Replace

Tipo de dados de sequência de caracteres (Visual Basic)