What is the best way to convert a string of text to a slug? Meaning:
- alpha allowed, convert to lowercase
- numbers are allowed
- spaces should be eliminated, not converted to dash ("-")
- accented characters replaced by equivalent standard alpha
- no other characters allowed, should be stripped out
I have found plenty of code online, but it all tends to convert spaces to dashes, which I do not want to do.
I am also interested optionally in varying the conversion, wherein:
- ampersand ("&") should be replaced by the string "and"
And also a variant wherein:
- Don't bother converting accented characters to equivalent standard alpha