10 Javascript Helpful String Manipulation Libraries

There are different ways to manipulate strings, look up parts of a string in various positions, and trim and replace strings. With each release of the JavaScript specification, more methods are added to make string search and manipulating easier than ever. So in this post I’ve collected some Javscript libraries that will make working with strings easy for developers.

Voca

The Voca library offers helpful functions to make string manipulations comfortable: change case, trim, pad, slugify, latinise, sprintf’y, truncate, escape and much more. The modular design allows to load the entire library, or individual functions to minimize the application builds. The library is fully tested, well documented and long-term supported.

Voca

String Format

JavaScript string formatting inspired by Python’s `str.format()`.

String Format

Fast Diff

This is a simplified import of the excellent diff-match-patch library by Neil Fraser into the Node.js environment. The match and patch parts are removed, as well as all the extra diff options. What remains is incredibly fast diffing between two strings.

Fast Diff

Escape Html

This module exports a single function, escapeHtml, that is used to escape a string of content such that it can be interpolated in HTML content.

Escape Html

Strip Ansi

Strip ANSI escape codes from a string.

Strip Ansi

Case

String case utitility: convert, identify, flip, extend.

Case

Filenamify

Convert a string to a valid safe filename.

Filenamify

Underscore.string

Javascript lacks complete string manipulation operations. This is an attempt to fill that gap. List of build-in methods can be found for example from Dive Into JavaScript. Originally started as an Underscore.js extension but is a full standalone library nowadays.

Underscore.string

Slugify

Slugify a string.

Slugify

Replace String

Replace all substring matches in a string.

Replace String

Leave a comment

Please be polite. We appreciate that. Your email address will not be published and required fields are marked

This site uses Akismet to reduce spam. Learn how your comment data is processed.