Explorar el Código

rotate method complete

Amy Gill hace 6 años
padre
commit
c0d7243f3d
Se han modificado 1 ficheros con 13 adiciones y 2 borrados
  1. 13
    2
      Crypto/src/ROT13.java

+ 13
- 2
Crypto/src/ROT13.java Ver fichero

@@ -31,8 +31,19 @@ public class ROT13  {
31 31
     }
32 32
 
33 33
     public static String rotate(String s, Character c) {
34
-
35
-        return "";
34
+//        int charIndex = 0;
35
+
36
+//       char[] charArray = s.toCharArray();
37
+//       for(int x = 0; x < charArray.length; x++){
38
+//           if (charArray[x] == c){
39
+//               charIndex = x;
40
+//           }
41
+//       }
42
+        int charIndex = s.indexOf(c);
43
+       String rightHalf = s.substring(charIndex);
44
+       String leftHalf = s.substring(0,charIndex);
45
+
46
+        return rightHalf + leftHalf;
36 47
     }
37 48
 
38 49