Lodash _.startCase() Method

Lodash _.startCase() method is used to convert the string to start case.

Syntax:

_.startCase( [string=''] );

Parameters:

  • string: This parameter holds the string to convert.

Return Value:

This method returns the start of the case string.

Example 1: In this example, we have used the _.startCase() method for converting the given string into the start case string.

Javascript




// Requiring the lodash library 
const _ = require("lodash"); 
      
// Use of _.startCase() method
console.log(_.startCase('Beginner for Beginner'));
console.log(_.startCase('w3wiki'));
console.log(_.startCase('@#$%w3wiki@#$%'));


Output:

'Beginner For Beginner'
'w3wiki'
'w3wiki'

Example 2: In this example, we have used the _.startCase() method for converting the given string into the start case string.

Javascript




// Requiring the lodash library 
const _ = require("lodash"); 
      
// Use of _.startCase() method
console.log(_.startCase(null));
console.log(_.startCase('123456789'));
console.log(_.startCase("gfg.Id"));


Output:

''
'123456789'
'Gfg Id'