utility functions to ease working with strings in javascript