1337 translator Java
Sad og kedede mig og lavede en encoder samt decoder til sproget 1337, i Java.
Læs mere om 1337
Jeg har lavet en encoder / decoder class samt en test class.
Leet.class
public class Leet {public void Leet(){
}
//Encoder
public void encodeLeet(String tekst){
tekst=tekst.toUpperCase();
tekst=tekst.replace(”A”, “4″);
tekst=tekst.replace(”B”, “8″);
tekst=tekst.replace(”C”, “(”);
tekst=tekst.replace(”D”, “|)”);
tekst=tekst.replace(”E”, “3″);
tekst=tekst.replace(”F”, “|=”);
tekst=tekst.replace(”G”, “6″);
tekst=tekst.replace(”H”, “|-|”);
tekst=tekst.replace(”I”, “1″);
tekst=tekst.replace(”J”, “_|”);
tekst=tekst.replace(”K”, “|<”);
tekst=tekst.replace(”L”, “1″);
tekst=tekst.replace(”M”, “|V|”);
tekst=tekst.replace(”N”, “|/|”);
tekst=tekst.replace(”O”, “0″);
tekst=tekst.replace(”P”, “9″);
tekst=tekst.replace(”Q”, “&”);
tekst=tekst.replace(”R”, “|2″);
tekst=tekst.replace(”S”, “5″);
tekst=tekst.replace(”T”, “7″);
tekst=tekst.replace(”U”, “|_|”);
tekst=tekst.replace(”V”, “√”);
tekst=tekst.replace(”W”, “VV”);
tekst=tekst.replace(”X”, “><”);
tekst=tekst.replace(”Y”, “`/”);
tekst=tekst.replace(”Z”, “2″);
System.out.println(tekst);
}
//Decoder
public void decodeLeet(String tekst){
tekst=tekst.toUpperCase();
tekst=tekst.replace(”4″, “A”);
tekst=tekst.replace(”8″, “B”);
tekst=tekst.replace(”(”, “C”);
tekst=tekst.replace(”|)”, “D”);
tekst=tekst.replace(”3″, “E”);
tekst=tekst.replace(”|=”, “F”);
tekst=tekst.replace(”6″, “G”);
tekst=tekst.replace(”|-|”, “H”);
tekst=tekst.replace(”1″, “L”);
tekst=tekst.replace(”_|”, “J”);
tekst=tekst.replace(”|<”, “K”);
tekst=tekst.replace(”1″, “L”);
tekst=tekst.replace(”|V|”, “M”);
tekst=tekst.replace(”|/|”, “N”);
tekst=tekst.replace(”0″, “O”);
tekst=tekst.replace(”9″, “P”);
tekst=tekst.replace(”&”, “Q”);
tekst=tekst.replace(”|2″, “R”);
tekst=tekst.replace(”5″, “S”);
tekst=tekst.replace(”7″, “T”);
tekst=tekst.replace(”|_|”, “U”);
tekst=tekst.replace(”√”, “V”);
tekst=tekst.replace(”VV”, “W”);
tekst=tekst.replace(”><”, “X”);
tekst=tekst.replace(”`/”, “Y”);
tekst=tekst.replace(”2″, “Z”);
System.out.println(tekst);
}
}
LeetTest.class
public class LeetTest {public void LeetTest(){
}
public static void main (String[] args){
Leet leet=new Leet();
//Encode text
leet.encodeLeet(”Eleet”);
//Decode text
leet.decodeLeet(”31337″);
}
}
Leave a Comment
You must be logged in to post a comment.

