Bladeren bron

committing string utilities

Carolynn Vansant 6 jaren geleden
bovenliggende
commit
bd516d85fc

+ 5
- 1
src/main/java/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.java Bestand weergeven

@@ -94,6 +94,10 @@ public class StringUtilities {
94 94
      * @return an identical string with characters in reverse order.
95 95
      */
96 96
     public static String reverseTheTwo(String stringToReverse){
97
-        return stringToReverse;
97
+        String reverse = "";
98
+        for(int i = stringToReverse.length()-1; i >= 0; i--) {
99
+            reverse += stringToReverse.charAt(i);
100
+        }
101
+        return reverse;
98 102
     }
99 103
 }