Fix Null Pointer Exception in strings/Upper (#3005)
Co-authored-by: Yang Libin <contact@yanglibin.info>
This commit is contained in:
parent
e7ff986414
commit
ab544c3b9f
@ -19,6 +19,9 @@ public class Upper {
|
||||
* @return the {@code String}, converted to uppercase.
|
||||
*/
|
||||
public static String toUpperCase(String s) {
|
||||
if (s == null || "".equals(s)) {
|
||||
return s;
|
||||
}
|
||||
char[] values = s.toCharArray();
|
||||
for (int i = 0; i < values.length; ++i) {
|
||||
if (Character.isLetter(values[i]) && Character.isLowerCase(values[i])) {
|
||||
|
Loading…
Reference in New Issue
Block a user