Check if at least 75% of a string is UPPERCASE
I'm writing bug tracking software in PHP, and today I saw this in another bug tracker: http://bugs.php.net/bug.php?id=12017
Now I want to add a feature in my software which will block titles where at least 开发者_StackOverflow中文版75% of all characters is uppercase.
How can I do this? Thanks,
P.S. CSS will not work, because, for example if you have the word 'iPod' in your title it turns into 'ipod' which sucks :)
strlen(preg_replace('/[A-Z]/', '', $str)) / strlen($str) > 0.25
Not tested, but you should get the idea.
精彩评论