Created
October 31, 2012 08:18
-
-
Save ranaroussi/3985821 to your computer and use it in GitHub Desktop.
prepare string for use in urls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function querify(str) { | |
str = encodeURIComponent(str.replace(/,/gi, ' ').replace(/\s{2,}/gi, ' ')).replace(/%20/gi, '+'); | |
return str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment