mengu on web programming.

How To Create Permalinks With Grails

I am developing a stackoverflow.com clone with Grails in order to digest it. I wanted to create permalinks or slugs of the questions for the urls. Since I already had the regular expression for this -I'm using it on this blog- all I needed to know how to use it with Groovy. The solution is simple as always. There is nothing hard in programming. Anyway, solution is here: def title = "How To Create Permalinks With Grails" slug = title.toLowerCase().replaceAll(" ", "-").replaceAll(/[^\sA-Za-z-0-9]/, "") println slug # result: how-to-create-permalinks-with-grails Enjoy! :)
Check my latest project compector.com where you can post references about your former employers and see what others have said about the future employers. Sign up now and post a reference and share it on twitter or facebook.

Comments

No comments made for this post.

Leave a Response

No HTML allowed. You can use markdown.
Name*:
E-Mail* (not published):
Web site:
Response: