Commits

Lucian Brănescu-Mihăilă committed 18b1bf9

Handle uppercase.

  • Participants
  • Parent commits 7aa258e

Comments (0)

Files changed (1)

 }
 
 func rot13(l byte) byte {
-    a := "a"[0]
-    z := "z"[0]
+    var a, z byte
+
+    if 'a' <= l && l <= 'z' {
+        a = 'a'
+        z = 'z'
+    } else if 'A' <= l && l <= 'Z' {
+        a = 'A'
+        z = 'Z'
+    }
 
     p := l + 13
 
     if p > z {
-        return a + p - z
+        return a + p - z - 1
     }
 
     return p