Browse Source

rotate method complete

Amy Gill 6 years ago
parent
commit
c0d7243f3d
1 changed files with 13 additions and 2 deletions
  1. 13
    2
      Crypto/src/ROT13.java

+ 13
- 2
Crypto/src/ROT13.java View File

@@ -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