Is there a good slugging algorithm or library out there to take a String of possibly all sorts of punctuation etc and convert it into a nice clean slug for a URL? Even better if the Play Framework has one already ;)
Asked
Active
Viewed 94 times
0
-
http://stackoverflow.com/questions/12226508/encode-an-url-with-play-2? – OlivierBlanvillain Mar 28 '14 at 17:03
-
thanks, not quite the same thing really, that is encoding all special chars as %... what I need is something to just create a human readable slug out of some text. – saintlyRook Mar 28 '14 at 17:33
1 Answers
1
I took the method from Play 1 and copied it to a module:
https://github.com/mariussoutier/Play-Extensions/blob/master/app/Implicits.scala#L12

Marius Soutier
- 11,184
- 1
- 38
- 48