RosettaCodeData/Task/Rot-13/Elena/rot-13.elena

32 lines
664 B
Plaintext

import system'routines;
import extensions;
import extensions'text;
singleton rotConvertor
{
char convert(char ch)
{
if (($97 <= ch && ch <= $109) || ($65 <= ch && ch <= $77))
{
^ (ch.toInt() + 13).toChar()
};
if (($110 <= ch && ch <= $122) || ($78 <= ch && ch <= $90))
{
^ (ch.toInt() - 13).toChar()
};
^ ch
}
string convert(string s)
= s.selectBy::(ch => rotConvertor.convert(ch)).summarize(new StringWriter());
}
public program()
{
if (program_arguments.Length > 1)
{
console.printLine(rotConvertor.convert(program_arguments[1]))
}
}