|
@@ -1,5 +1,6 @@
|
1
|
1
|
package com.zipcodewilmington.danny_do_better_exercises;
|
2
|
2
|
|
|
3
|
+
|
3
|
4
|
/**
|
4
|
5
|
* Created by dan on 6/14/17.
|
5
|
6
|
*/
|
|
@@ -100,10 +101,15 @@ public class StringUtilities {
|
100
|
101
|
*/
|
101
|
102
|
public static String reverseTheTwo(String stringToReverse){
|
102
|
103
|
//so if the string contains a space, I want to split it then reverse it
|
103
|
|
- if (stringToReverse.contains(" ")
|
104
|
|
- return(reverse(stringToReverse.split(" ")));
|
105
|
|
- else //if not still reverse it
|
106
|
|
- return(reverse(stringToReverse));
|
|
104
|
+ StringBuilder sb = new StringBuilder(stringToReverse);
|
|
105
|
+ return sb.reverse().toString();
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+// if (stringToReverse.contains(" "){
|
|
109
|
+// return(reverse(stringToReverse.split(" ")));
|
|
110
|
+// }else{ //if not still reverse it
|
|
111
|
+// return(reverse(stringToReverse));
|
|
112
|
+// }
|
107
|
113
|
}
|
108
|
114
|
}
|
109
|
115
|
|