DansTonCode.net
quote.smartness() == 42C is quirky, flawed, and an enormous success.@author Dennis M. Ritchie
Quote #299
java
@
author 
Anonymous
0
    public static final String escapePl(String s){
        StringBuffer sb = new StringBuffer();
        int n = s.length();
        for (int i = 0; i < n; i++) {
         char c = s.charAt(i);
         switch (c) {
             case &#39;ą&#39;: sb.append("a"); break;
             case &#39;ć&#39;: sb.append("c"); break;
             case &#39;ę&#39;: sb.append("e"); break;
             case &#39;ł&#39;: sb.append("l"); break;
             case &#39;ń&#39;: sb.append("n"); break;
             case &#39;ó&#39;: sb.append("o"); break;
             case &#39;ś&#39;: sb.append("s"); break;
             case &#39;ź&#39;: sb.append("z"); break;
             case &#39;ż&#39;: sb.append("z"); break;
             case &#39;Ą&#39;: sb.append("A"); break;
             case &#39;Ć&#39;: sb.append("C"); break;
             case &#39;Ę&#39;: sb.append("E"); break;
             case &#39;Ł&#39;: sb.append("L"); break;
             case &#39;Ń&#39;: sb.append("N"); break;
             case &#39;Ó&#39;: sb.append("O"); break;
             case &#39;Ś&#39;: sb.append("S"); break;
             case &#39;Ź&#39;: sb.append("Z"); break;
             case &#39;Ż&#39;: sb.append("Z"); break;

            default: sb.append(c); break;
          }
       }

         return sb.toString();
     }
Code-source en java proposé par Anonymous
 
 0