|
@@ -63,11 +63,14 @@ public class StringUtils {
|
63
|
63
|
return str2;
|
64
|
64
|
}
|
65
|
65
|
|
66
|
|
- public static String invertCasing(String str) {
|
67
|
|
-
|
68
|
|
- for (int i = 0; i <str.length() ; i++) {
|
69
|
|
- // if (str.charAt(i))
|
|
66
|
+ public static String invertCasing(String text) {
|
|
67
|
+ StringBuilder textSB = new StringBuilder(text);
|
|
68
|
+ for(int i = 0; i < text.length(); i++) {
|
|
69
|
+ if(text.charAt(i) > 64 && text.charAt(i) < 91)
|
|
70
|
+ textSB.setCharAt(i, (char)(text.charAt(i) + 32));
|
|
71
|
+ else if(text.charAt(i) > 96 && text.charAt(i) < 123)
|
|
72
|
+ textSB.setCharAt(i, (char)(text.charAt(i) - 32));
|
70
|
73
|
}
|
71
|
|
- return null;
|
|
74
|
+ return textSB.toString();
|
72
|
75
|
}
|
73
|
76
|
}
|