Answers for "how to check if a string has a capital letter javascript"

5

check if letter is uppercase javascript

const isUpperCase = (string) => /^[A-Z]*$/.test(string)
Posted by: Guest on November-28-2020
1

check if letter is uppercase javascript

var strings = 'this iS a TeSt 523 Now!';
var i=0;
var character='';
while (i <= strings.length){
    character = strings.charAt(i);
    if (!isNaN(character * 1)){
        alert('character is numeric');
    }else{
        if (character == character.toUpperCase()) {
            alert ('upper case true');
        }
        if (character == character.toLowerCase()){
            alert ('lower case true');
        }
    }
    i++;
}
Posted by: Guest on November-28-2020
0

find capital word in string javascript

const str = "HERE'S AN UPPERCASE PART of the string";
const upperCaseWords = str.match(/(\b[A-Z][A-Z]+|\b[A-Z]\b)/g);

console.log(upperCaseWords);
Posted by: Guest on May-04-2021
0

how to check if a letter is capital in javascript

// program to convert first letter of a string to uppercase
function capitalizeFirstLetter(str) {

    // converting first letter to uppercase
    const capitalized = str.charAt(0).toUpperCase() + str.slice(1);

    return capitalized;
}

// take input
const string = prompt('Enter a string: ');

const result = capitalizeFirstLetter(string);

console.log(result);
Posted by: Guest on November-01-2021

Code answers related to "how to check if a string has a capital letter javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language