A note about the possible duplicate question
The accepted answer to that question does not work.
It incorrectly reports spaces and other non-letter characters as toUpperCase==true. :-(
But I now see that one of the other answers does provide a successful solution. The correct answer on this previous question is from ciembor. I'll leave this question posted because this accepted answer from Barmar correctly solves the issue.
How can I determine which characters in a string of text are capital letters?
My first try was testing with .toUpperCase
, but non-letter characters also return true:
var text="Romeo & Juliet";
var characters=text.split('');
// and test with
characters[i]===characters[i].toUpperCase() // but spaces and "&" also test as true
Next I though of using regex and testing with A-Z
but non-English character sets might have capital letters outside this range.
Anyone have way to determine if a character is a capital letter?