Java rot13 Hash rot13(String input)

Here you can find the source of rot13(String input)

Description

ROMAN

License

Open Source License

Declaration


public static final String rot13(String input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from w w w .ja  v  a2s . c  o m*/
     * ROMAN
     */

    public static final String rot13(String input) {
        char[] out = input.toCharArray();
        int i = 0;
        for (char c : out) {
            if (c >= 'a' && c <= 'z') {
                c -= 'a';
                c += 13;
                c %= 26;
                c += 'a';
            } else if (c >= 'A' && c <= 'Z') {
                c -= 'A';
                c += 13;
                c %= 26;
                c += 'A';
            } else if (c >= '0' && c <= '9') {
                c -= '0';
                c += 5;
                c %= 10;
                c += '0';
            }
            out[i++] = c;
        }
        return new String(out);
    }
}

Related

  1. rot13(final byte b)
  2. rot13(String _input)
  3. rot13(String argInput)
  4. rot13(String input)
  5. rot13(String s)
  6. rot13(String string)
  7. rot13(String text)