rot13.frink

Download or view rot13.frink in plain text format


// Rot-13 encoding/decoding.

rot13[str] :=
{
   chars = chars[str]
   ret = new array

   for c = chars
   {
      if (c >= char["A"] and c <= char["Z"])
         c = ((c - char["A"] + 13) mod 26) + char["A"]
      else
         if (c >= char["a"] and c <= char["z"])
            c = ((c - char["a"] + 13) mod 26) + char["a"]

      ret.push[c];
   }

   return char[ret];
}


Download or view rot13.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 19944 days, 20 hours, 38 minutes ago.