A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/lodash-_-camelcase-method/ below:

Lodash _.camelCase() Method - GeeksforGeeks

Lodash _.camelCase() Method

Last Updated : 18 Oct, 2023

Lodash _.camelCase() method is used to convert a string into a camel case string. The string can be space-separated, dash-separated, or can be separated by underscores.

Syntax:
_.camelCase(string);
Parameters: Return Value:

This method returns the camel case string

Example 1: In this example, we are changing the string which is space-separated and dash-separated into the camel case using the _.camelCase() method.

JavaScript
// Requiring the lodash library 
const _ = require('lodash');

// Use of _.camelCase() method
let str1 = _.camelCase("Geeks for Geeks");

// Printing the output 
console.log(str1);

// Use of _.camelCase() method
let str2 = _.camelCase("GFG-Geeks");

// Printing the output 
console.log(str2);

Output:

geeksForGeeks
gfgGeeks

Example 2: In this example, we are changing the string which is underscore-separated into the camel case using the _.camelCase() method.

JavaScript
// Requiring the lodash library 
const _ = require('lodash');

// Use of _.camelCase() method
let str1 = _.camelCase("Geeks__for__Geeks");

// Printing the output 
console.log(str1);

// Use of _.camelCase() method
let str2 = _.camelCase("GFG--Geeks");

// Printing the output 
console.log(str2);

Output:

geeksForGeeks
gfgGeeks


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4