Easy way to replace all non-alpha numeric chars in a string?

D

deja

Is there an easy (clean) method to replace all non-alpha numeric chars
in a string with and underscore?

for example:

I want to transform the following string:

"The book titled 'Ruby is Great' was written on 05/31/2006"

into:

"The_book_titled__Ruby is Great__was written on 05_31_2006"

Thank you in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top