Useful collection of JavaScript string utilities.

// https://gist.github.com/jonlabelle/5375315