home *** CD-ROM | disk | FTP | other *** search
- /* Rot13 a Mg-region */
-
- options results
-
- 'rexx-region' fooey
- 'kill-region'
-
- do i=1 to fooey.0
- if index(fooey.i,'0d'x) then text=slashquote(rot13(left(fooey.i,length(fooey.i)-1)))||'\n'
- else text=slashquote(rot13(fooey.i))
- 'rexx-insert "'||text||'"'
- end
- exit
-
- rot13: procedure
- parse arg foo
- foo = translate(foo,'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM','abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
- return foo
-
- /* slashquote - puts '\' in front of any '"''s or '\''s we find in a string */
- slashquote: procedure
- parse arg in
-
- i = index(in, '\')
- do while i > 0
- in = substr(in, 1, i - 1)'\\'substr(in, i + 1)
- i = index(in, '\', i + 2)
- end
-
- i = index(in, '"')
- do while i > 0
- in = substr(in, 1, i - 1)'\"'substr(in, i + 1)
- i = index(in, '"', i + 2)
- end
-
- return in
-
-