rot13.frink

View or download 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];
}


View or download 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 17590 days, 6 hours, 55 minutes ago.