programming-examples/js/Vre1/Check whether the first character of a string is uppercase or not.js

14 lines
370 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
function upper_case(str)
{
regexp = /^[A-Z]/;
if (regexp.test(str))
{
console.log("String's first character is uppercase");
}
else
{
console.log("String's first character is not uppercase");
}
}
upper_case('Abcd');
upper_case('abcd');