Función Replace

Sustituye una cadena por otra.

Sintaxis:

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

Valor de retorno:

Cadena

Parámetros:

Texto: cualquier expresión de cadena que se quiera modificar.

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 where the search starts and also the start of the substring to be returned.

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 error:

5 Llamada a procedimiento no válida

Ejemplo:


        msgbox replace ("aBbcnnbnn", "b", "$", 1, 1, FALSE)'returns "aB$cnnbnn"
        REM significado: «b» debería sustituirse, pero
        REM * nada más en minúscula (parámetro 6), por consiguiente la 2.ª ocurrencia de «b»
        REM * solo la primera ocurrencia (que respeta mayusculación) (parámetro 5)
        msgbox replace ("ABCDEFGHI", "E", "*", 4)
        REM returns D*FGHI because the search starts at position 4, which is also the start of the returned string.
    

¡Necesitamos su ayuda!