Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

JavaScript Function To Generate URLs Without Any Rubbish

DZone's Guide to

JavaScript Function To Generate URLs Without Any Rubbish

·
Free Resource
// We couldn't find any free function available, for this reason our Sergey built an collection of amazing JS //function for Orchid box CMS. We have decided to release it to the world so no other developer should //struggle //as we did. eg. This, is my post n.1? = this_is_my_post_n_1


//Have you ever wanted to generate perfect URL from blog post or any page title?


//We couldn't find any free function available, for this reason our Sergey built an collection of amazing JS //function for Orchid box CMS. We have decided to release it to the world so no other developer should //struggle as we did.


//URL stripper features:

//-          Strip of any non alphanumeric characters

//-          Space converted to _

//-          Not more than one _ between alphanumeric characters

//-          JS function can be invoked on focus, hence very fast

 
//The function : GenerateUrl  would transform :

//source: this is my title
//result: this_is_my_title
//Source: This is my n.1 post, really ? Should I have written more          , or     less    ?
//Result: This_is_my_n_1_post_really_Should_I_have_written_more_or_less
//Source: rubbish characters : &^%&^%&%*^(**&^%"£%"££^%$&^%^& (I am not rubbish)
//Result: rubbish_characters_I_am_not_rubbish

http://digg.com/software/JavaScript_function_to_generate_URLs_without_any_rubbish
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}