Example 1: check if letter is uppercase javascript
const isUpperCase = (string) => /^[A-Z]*$/.test(string)
Example 2: regex for lowercase letters js
function hasLowerCase(str) { return (/[a-z]/.test(str)); }
Example 3: check if letter is uppercase javascript
isUpperCase('A') isUpperCase('a')
Example 4: 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++; }
Comments
Post a Comment