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( 'geeks for geeks' ));
console.log(_.startCase( 'geeksforgeeks' ));
console.log(_.startCase( '@#$%geeksforgeeks@#$%' ));
|
Output:
'Geeks For Geeks'
'Geeksforgeeks'
'Geeksforgeeks'
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'
Recommended Articles