isCapitalized

Test if a value is a string having an uppercase first character.

Usage

var isCapitalized = require( '@stdlib/assert/is-capitalized' );

isCapitalized( value )

Tests if a value is a string having an uppercase first character.

var bool = isCapitalized( 'Every noble work is at first impossible.' );
// returns true

bool = isCapitalized( 'HELLO WORLD!' );
// returns true

bool = isCapitalized( 'salt and light' );
// returns false

Notes

  • The function validates that a value is a string. For all other types, the function returns false.

Examples

var isCapitalized = require( '@stdlib/assert/is-capitalized' );

var bool = isCapitalized( 'Hello' );
// returns true

bool = isCapitalized( 'HELLO' );
// returns true

bool = isCapitalized( '' );
// returns false

bool = isCapitalized( 'hello' );
// returns false

CLI

Usage

Usage: is-capitalized [options] [<string>]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Examples

$ is-capitalized Beep
true

To use as a standard stream,

$ echo -n 'boop' | is-capitalized
false
Did you find this page helpful?