Hallo Leute,
ich hab mal ne Frage zu folgendem Code:
Wofür benötigt man die zweite for-Schleife?
Grüße,
Poines
ich hab mal ne Frage zu folgendem Code:
Java:
public class Leet {
public static void main(String[] args) {
String strings[] = {"We are elite hackers!", "Informatiker machen coole Sachen!"};
strings = allToLeet(strings);
System.out.println(strings[0]);
System.out.println(strings[1]);
}
public static String toLeet(String normal){
String[] alt = new String[] {"elite","cool","!","ck","ers","er","en","e","t","o","a"};
String[] neu = new String[] {"1337","k3wl","!!!11","xx","0rz","0rz","n","3","7","0","@"};
for (int i = 0; i< neu.length; i++){
normal = normal.replaceAll(alt[i], neu[i]);
}
return normal;
}
public static String[] allToLeet(String[] normals){
for(int i = 0; i<normals.length; i++){
normals[i]= toLeet(normals[i]);
}
return normals;
}
}
Wofür benötigt man die zweite for-Schleife?
Grüße,
Poines