/ Published in: Ruby
Use this to sanitize a string and convert all wierd characters to your choice of delimiter
- #substitute string_name for your variable or a string
- #substitute "-" for your choice of character
- #note: doesn't recognize accented characters properly
- string_name.gsub(/[^a-z0-9]+/i, '-')
You need to login to post a comment.