Replace string characters

Replace string characters

Hi there.

I need to replace all the strange characters present in a string (i.e ç,ã,õ, ...) and replace them with new ones (ç = c, ã = a, õ = o, ...). How can i do that in a simple way?

Using the replace function i can only replace one char at a time.. I need to replace all the chars present in the string at te same time!

Hi Pedro,

So we can help you in what context are you needing this?

Hi Pedro and wellcome,

What you need is an encapsulated action that replaces all of those ocurrences, I call this the UFO pattern... you'll understand why when you see my example and start adding more chars to replace. :) 

Pelase check the attach and ask if you have any doubts.

Hermínio Mira

In my application i need to set an internal name. For example, original name is "São Sebastião" and the internal name must be "saosebastiao". I need to use the tolower function and another function that replaces all the chars that i don't want!

Hermínio, thanks a lot! Worked perfectly!

There's a lot of conditions i must add. =)

You will see a UFO for sure then! :)