Lodash String Methods

Beginner
6 min read
Updated: Nov 2026
30 method guides
Method index

About This Index

This page is the Lodash String index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.

Learn chaining on /lodash/seq. Use this page when you need string helpers such as _.camelCase(), _.trim(), or _.escape().

Beginner path.

Start with _.camelCase(), then _.trim(), _.escape(), and _.truncate()—then browse case and template helpers.

How to Call a String Method

Pass a string (and any options) to the Lodash helper—results are new values:

Lodash
import _ from "lodash";

_.camelCase("Foo Bar");     // "fooBar"
_.kebabCase("fooBar");      // "foo-bar"
_.snakeCase("fooBar");      // "foo_bar"
_.startCase("--foo-bar--"); // "Foo Bar"

_.trim("  hello  ");        // "hello"
_.padStart("5", 3, "0");    // "005"
_.truncate("hi-diddly-ho", { length: 10 }); // "hi-didd..."

_.escape("<div>");          // "&lt;div&gt;"
_.words("fred, barney, & pebbles");
// ["fred", "barney", "pebbles"]

Lodash String Methods Table

All string method guides in this Lodash tutorial series (30 tutorials).

Case Conversion

11 methods

camelCase, kebab-case, snake_case, Start Case, and first-letter helpers.

MethodDescriptionTutorial
_.camelCase()Convert a string to camelCase (e.g. "foo bar" → "fooBar").Try it
_.capitalize()Uppercase the first character and lowercase the rest.Try it
_.kebabCase()Convert a string to kebab-case (e.g. "fooBar" → "foo-bar").Try it
_.snakeCase()Convert a string to snake_case (e.g. "fooBar" → "foo_bar").Try it
_.startCase()Convert to Start Case with capitalized words.Try it
_.lowerCase()Convert a string to space-separated lower case (Lodash word rules).Try it
_.upperCase()Convert a string to space-separated upper case (Lodash word rules).Try it
_.toLower()Convert the entire string to lower case.Try it
_.toUpper()Convert the entire string to upper case.Try it
_.lowerFirst()Lowercase only the first character of the string.Try it
_.upperFirst()Uppercase only the first character of the string.Try it

Trim & Pad

6 methods

Trim edges and pad strings to a target length.

MethodDescriptionTutorial
_.trim()Remove leading and trailing whitespace (or custom chars).Try it
_.trimStart()Remove leading whitespace (or custom chars).Try it
_.trimEnd()Remove trailing whitespace (or custom chars).Try it
_.pad()Pad a string on left and right to a target length.Try it
_.padStart()Pad the start of a string to a target length.Try it
_.padEnd()Pad the end of a string to a target length.Try it

Escape & Template

4 methods

HTML and RegExp escaping, unescape, and templates.

MethodDescriptionTutorial
_.escape()Escape HTML special characters (&, <, >, ", ') for safe text output.Try it
_.unescape()Reverse HTML entity escaping from _.escape().Try it
_.escapeRegExp()Escape RegExp metacharacters so a string can be used literally.Try it
_.template()Compile a template string with interpolate, escape, and evaluate tags.Try it

Frequently Asked Questions

They format and clean text: case conversion (_.camelCase, _.kebabCase), trim/pad, HTML escaping (_.escape), truncation, word splitting (_.words), and template compilation (_.template).
No. JavaScript strings are immutable. Every Lodash string helper returns a new string (or boolean/number/array) without changing the input.
Native covers basics like trim and toLowerCase. Lodash shines for case conversion, deburr, truncate with omission, escape/unescape, and _.template().
Prefer per-method imports: import camelCase from 'lodash/camelCase' or import { camelCase } from 'lodash-es'. You can also use const _ = require('lodash') and call _.camelCase().
Start with _.camelCase(), then _.trim(), _.escape(), and _.truncate() from the table below.

Start with _.camelCase()

Open the case conversion guide—syntax, examples, and FAQs.

_.camelCase() tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

14 people found this page helpful