Conteúdo
Índice 🔎︎

# Replace Function

Replaces some string by another.

### Sintaxe:

Replace (Text As String, SearchStr As String, ReplStr As String [, Start As Long [, Count as long [, Compare As Boolean]]]

### Valor de retorno:

String

### Parâmetros:

Text: Any string expression that you want to modify.

SearchStr: Any string expression that shall be searched for.

ReplStr: Any string expression that shall replace the found search string.

Start: Numeric expression that indicates the character position within the string where the search shall begin. The maximum allowed value is 65535.

Count: The maximal number of times the replace shall be performed.

Compare: Optional boolean expression that defines the type of comparison. The value of this parameter can be TRUE or FALSE. The default value of TRUE specifies a text comparison that is not case-sensitive. The value of FALSE specifies a binary comparison that is case-sensitive. You can as well use 0 instead of FALSE or 1 instead of TRUE.

## Códigos de erro

5 Chamada de procedimento inválido

### Exemplo:

            msgbox replace ("aBbcnnbnn", "b", "$", 1, 1, FALSE)'returns "aB$cnnbnn"
            REM sendo que: "b" deveria ser substituído, mas
            REM * only when lowercase (parameter 6), hence second occurrence of "b"
            REM * only first (respecting case) occurrence (parameter 5)