Citation de code source en Javan° 272
7 June 2016 à 01:30
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 '?': sb.append("a"); break;
case '?': sb.append("c"); break;
case '?': sb.append("e"); break;
case '?': sb.append("l"); break;
case '?': sb.append("n"); break;
case 'ó': sb.append("o"); break;
case '?': sb.append("s"); break;
case '?': sb.append("z"); break;
case '?': sb.append("z"); break;
case '?': sb.append("A"); break;
case '?': sb.append("C"); break;
case '?': sb.append("E"); break;
case '?': sb.append("L"); break;
case '?': sb.append("N"); break;
case 'Ó': sb.append("O"); break;
case '?': sb.append("S"); break;
case '?': sb.append("Z"); break;
case '?': sb.append("Z"); break;
default: sb.append(c); break;
}
}
return sb.toString();
}