Answers for "make regex in javascript to check a string is having 1st character capital and others small"

0

regex only uppercase letters js

if (value.match(/^[A-Z]*$/)) {
    // matches
} else {
    // doesn't match
}
Posted by: Guest on October-28-2020
1

javascript lowercase string except first letter of every word if there are ''

var text = "foo bar 'loo' zoo moo";
text = text.toLowerCase().split(' ').map((s) => { if(s.charAt(0)!=="'") return s.charAt(0).toUpperCase() + s.substring(1)
      else return s.charAt(0)+s.charAt(1).toUpperCase() + s.substring(2)}).join(' ');
//text = "Foo Bar 'Loo' Zoo Moo"
Posted by: Guest on September-10-2021

Code answers related to "make regex in javascript to check a string is having 1st character capital and others small"

Code answers related to "Javascript"

Browse Popular Code Answers by Language