开发者

Check if at least 75% of a string is UPPERCASE

开发者 https://www.devze.com 2022-12-09 17:05 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消