Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. public class Neki {
  2.     private static String[] cr = {".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."};
  3.     private static String[] st = {".----", "..---", "...--", "....-", ".....", "-....", "--...", "---..", "----.", "-----"};
  4.     public static void main(String[] args){
  5.         String s = "scistite pesca s cestisca".trim().toUpperCase();
  6.         String d = "[[";
  7.         for(char a : s.toCharArray()){
  8.             if(a == ' '){
  9.                 d += "]; [";
  10.             }else{
  11.                 String f = a > '0'? cr[a - 'A'] : st[a - '0'];
  12.                 d += "[";
  13.                 for(char x : f.toCharArray()) d += "\'"+x+"\'; ";
  14.                 d = d.substring(0, d.length()-2) +"]; ";
  15.             }
  16.         }
  17.         d = d.substring(0, d.length()-3) +"]]]";
  18.         System.out.println(d);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement