|
@@ -68,7 +68,8 @@ public class StringUtilities {
|
68
|
68
|
public static Character getMiddleCharacter(String inputValue){
|
69
|
69
|
int str = inputValue.length();
|
70
|
70
|
|
71
|
|
- return inputValue.charAt(str / 2);
|
|
71
|
+ return inputValue.charAt(Math.round(str / 2));
|
|
72
|
+
|
72
|
73
|
}
|
73
|
74
|
|
74
|
75
|
/**
|
|
@@ -85,8 +86,8 @@ public class StringUtilities {
|
85
|
86
|
* @return the second word of a string delimited by spaces.
|
86
|
87
|
*/
|
87
|
88
|
public static String getSecondWord(String spaceDelimitedString){
|
88
|
|
- int spacer = spaceDelimitedString.lastIndexOf(" ");
|
89
|
|
- return spaceDelimitedString.substring(spacer);
|
|
89
|
+ int spacer = spaceDelimitedString.indexOf(" ");
|
|
90
|
+ return spaceDelimitedString.substring(spacer + 1, spaceDelimitedString.length());
|
90
|
91
|
}
|
91
|
92
|
|
92
|
93
|
/**
|
|
@@ -94,7 +95,7 @@ public class StringUtilities {
|
94
|
95
|
* @return an identical string with characters in reverse order.
|
95
|
96
|
*/
|
96
|
97
|
|
97
|
|
- public static String reverseTheTwo(String stringToReverse) {
|
|
98
|
+ public static String reverse(String stringToReverse) {
|
98
|
99
|
String reverse = "";
|
99
|
100
|
for (int i = stringToReverse.length() - 1; i >= 0; i--) {
|
100
|
101
|
reverse += stringToReverse.charAt(i);
|
|
@@ -102,8 +103,5 @@ public class StringUtilities {
|
102
|
103
|
return reverse;
|
103
|
104
|
}
|
104
|
105
|
|
105
|
|
- public static String reverse(String stringToReverse){
|
106
|
|
- return null;
|
107
|
106
|
|
108
|
|
- }
|
109
|
107
|
}
|