SHARE
TWEET

Rot13/Derot

capasha Sep 9th, 2012 (edited) 674 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static string derot(string token) {
  2. string res;
  3.  foreach (char ch in token)
  4.  {
  5.    char nc = ch;
  6.    if (ch >= 'a' && ch <= 'z')
  7.    {
  8.      if (ch > 'm') nc = (char)(ch - 13);
  9.      else nc = (char)(ch + 13);
  10.    }
  11.    else if (ch >= 'A' && ch <= 'Z')
  12.    {
  13.      if (ch > 'M') nc = (char)(ch - 13);
  14.      else nc = (char)(ch + 13);
  15.    }
  16.   res += nc;
  17.  }
  18. return res;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top