Skip to content Skip to sidebar Skip to footer

Javascript String Library

I'm using Jquery for DOM manipulation, and I'm finding it invaluable. Is there a similar library for strings? I find myself needing to do manipulations and running selectors on par

Solution 1:

You can use regular expressions to do powerful matching and replacements in strings. It's completely different from JQuery selectors as it's not based on CSS, but it's more powerful.

For example, put a span tag around all occurances of a word:

s = s.replace(/stackoverflow/g, '<span class="Found">$1</span>');

Post a Comment for "Javascript String Library"