Skip to main content

Replace

Replace (Função)​

Formato​

replace ( expressão_string_palheiro , expressão_de , expressão_para )
replace ( expressão_string_palheiro , expressão_de , expressão_para , ignorar_maiúsculas)

devolve uma string

Descrição​

Devolve uma nova string em que todas as ocorrências de de na string palheiro são substituídas por para. Pode também indicar um valor booleano opcional, ignorar_maiúsculas, que faz a pesquisa tratar as letras maiúsculas e minúsculas como iguais.

Exemplo​

a$ = "We all live in a yellow submarine, yellow submarine, yellow submarine."
print Replace(a$,"yellow","blue")
print Replace(a$, "we", "Beatles", true)

vai mostrar

We all live in a blue submarine, blue submarine, blue submarine.
Beatles all live in a yellow submarine, yellow submarine, yellow submarine.

Ver também​

Asc, Chr, Count, Countx, Explode, Explodex, Implode, Instr, Instrx, Left, Length, Ljust, Lower, LTrim, MD5, Mid, Midx, Replace, Replacex, Right, Rjust, RTrim, Serialize, String, Trim, Unserialize, Upper, Zfill

Histórico​

0.9.6.55Novo nesta versão