1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| public static boolean contains (String[] tab, String c) {
boolean res=false;
for (int i=0;i<tab.length;i++){
if (areStringEqual(c,tab[i])){
res=true;
}
}
return res;
}
public static String filter (String str, String[] tab) {
String res="";
for (int i=0;i<str.length();i++){
if(contains(tab,str)){
res=res+stringCharAt(str,i);
}
}
return res;
}
// FONCTION AUTORISEES //
public static String stringCharAt(String str, int idx) {
return String.valueOf(str.charAt(idx));
}
public static boolean areStringEqual (String s1, String s2) {
if (s1 == null) {
return s2 == s1;
} else {
return s1.equals (s2);
} |
Partager