pascalcase

Convert a string to Pascal case.

Usage

var pascalcase = require( '@stdlib/string/base/pascalcase' );

pascalcase( str )

Converts a string to Pascal case.

var out = pascalcase( 'foo bar' );
// returns 'FooBar'

out = pascalcase( 'IS_MOBILE' );
// returns 'IsMobile'

out = pascalcase( 'Hello World!' );
// returns 'HelloWorld'

out = pascalcase( '--foo-bar--' );
// returns 'FooBar'

Examples

var pascalcase = require( '@stdlib/string/base/pascalcase' );

var str = 'Hello World!';
var out = pascalcase( str );
// returns 'HelloWorld'

str = 'HELLO WORLD!';
out = pascalcase( str );
// returns 'HelloWorld'

str = 'To be, or not to be: that is the question.';
out = pascalcase( str );
// returns 'ToBeOrNotToBeThatIsTheQuestion'
Did you find this page helpful?