Rot-13: Difference between revisions

Added OmniMark solution
(Add ed example)
(Added OmniMark solution)
 
Line 4,723:
`Jung n phevbhf srryvat!' fnvq Nyvpr; `V zhfg or fuhggvat hc yvxr n gryrfpbcr.'
`What a curious feeling!' said Alice; `I must be shutting up like a telescope.'
</pre>
 
=={{header|OmniMark}}==
 
<syntaxhighlight lang="omnimark">
; rot-13.xom
global stream gs-phrase
 
define stream function apply-rot-13 (value stream phrase) as
local integer b
local stream ciphered
open ciphered as buffer
repeat scan phrase
match letter => char
set b to char binary 0
increment b by 13
decrement b by 26 when char matches uc and b > 90
decrement b by 26 when char matches lc and b > 122
put ciphered "b" % b
match any => char
put ciphered char
again
close ciphered
return ciphered
 
process
output apply-rot-13(gs-phrase)
</syntaxhighlight>
 
{{Out}}
<pre>
> omnimark -sb rot-13.xom -d gs-phrase "abc"
nop
> omnimark -sb rot-13.xom -d gs-phrase "nop"
abc
> omnimark -sb rot-13.xom -d gs-phrase "Rot-13 is easy to crack!"
Ebg-13 vf rnfl gb penpx!
> omnimark -sb rot-13.xom -d gs-phrase "Ebg-13 vf rnfl gb penpx!"
Rot-13 is easy to crack!
</pre>
 
19

edits