来源:https://www.programcreek.com/2011/04/a-method-to-detect-if-string-contains-1-uppercase-letter-in-java/
My approach
This method loop through each character in the string, and determine if each character is in upper case. Upper case letter value is from 97 to 122.
|
Any other better approach regarding the performance?
Option
From Hans Dampf's comment below:
Use java.lang.Character#isUpperCase() and #isLetter() instead of the magic numbers.
本文分享自微信公众号 - 彤哥读源码(gh_63d1b83b9e01)。
如有侵权,请联系 [email protected] 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。