Is there a simple way to check how many times a character appears in a String?
This counts a in below example:
str = "A man is as good as his word";
alert(str.split('a').length-1);
If you want case insensitive you'd want something like
alert(str.split( new RegExp( "a", "gi" ) ).length-1);
So that it grabs "A" and "a" ... "g" flag isn't really needed, but you do need the "i" flag