rot13 decode in java

Jean-Paul

Relating to this question: ROT-13 function in java?

What would be the code to decode rot13 in java? Do I simply reverse the signs?

Below is the code for encoding a String into rot13:

public class Rot13 { 

    public static void main(String[] args) {
        String s = args[0];
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if       (c >= 'a' && c <= 'm') c += 13;
            else if  (c >= 'A' && c <= 'M') c += 13;
            else if  (c >= 'n' && c <= 'z') c -= 13;
            else if  (c >= 'N' && c <= 'Z') c -= 13;
            System.out.print(c);
        }
        System.out.println();
    }

}
Eran

You don't reverse the signs. The decoding method is identical to the encoding method.

For example : 'a' is encoded to 'n'. If you "encode" the 'n', it is decoded back to 'a'.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Java中的rot13解码

来自分类Dev

Rot13 Java 有什么问题?

来自分类Dev

Rot13和使用模数

来自分类Dev

如何在Swift中实现ROT13函数?

来自分类Dev

Rot13实现:translate_string函数中的错误

来自分类Dev

解码python rot13字符串

来自分类Dev

使用字符数组的 ROT13 实现

来自分类Dev

用Python进行rot13编码的文件是什么,名称是什么?

来自分类Dev

可以在一行中写一个ROT13吗?

来自分类Dev

试图做类似rot13的解决方案,可以处理特殊字符

来自分类Dev

试图做类似rot13的解决方案,可以处理特殊字符

来自分类Dev

汇编语言中的Rot13模糊处理无法正常工作

来自分类Dev

用Python进行rot13编码的文件是什么,名称是什么?

来自分类Dev

使用unicode.encode('rot13')时如何修复UnicodeEncodingError

来自分类Dev

将 rot13(或其他加密)应用于端口上的所有转发流量

来自分类Dev

Rot13 示例:如何在 Google App Engine 中运行这段代码?

来自分类Dev

java.lang.OutOfMemoryError-BitmapFactory.decode(strPath)

来自分类Dev

Java-URLDecoder.decode(String s)与URLDecoder.decode(String s,String enc)

来自分类Dev

Java Base64.getDecoder().decode() c# 等效

来自分类Dev

rot-13中的换行问题

来自分类Dev

如何在 Java 8 中对字符串数组使用 Base64.decode

来自分类Dev

Java 的 ' byte[] decodeFile = Base64.getMimeDecoder().decode(fileBase64); 有替代方案吗?' 在 Python 中?

来自分类Dev

如何在 MFC 中进行“rot-13 解码”?

来自分类Dev

Oracle DECODE与NVL

来自分类Dev

树枝:url_decode

来自分类Dev

JpegBitmapDecoder decode jpeg failed?

来自分类Dev

DECODE函数语法

来自分类Dev

Python .decode函数

来自分类Dev

如何从CharsetDecoder的.decode()生成UnmappableCharacterException?

Related 相关文章

热门标签

归档