heronasro1
-
7 juin 2013 à 23:03
Twinuts
Messages postés5375Date d'inscriptiondimanche 4 mai 2003StatutModérateurDernière intervention14 juin 2023
-
9 juin 2013 à 09:33
j'ai un probleme concerne l'affiche de cette programme ; ask qlq peut m'aider ;;; Urgent ^^
public class mss {
public static void main(String args[]) {
String texte = "salama salama salmatation saLama salama? aaa ????? aaa VA , §§§§§ 1 2 3 4 5 6 l'ecole la a Z aaa a a a a AA A SAlama";
String str = "" ;
Set set = new TreeSet();
List l = new LinkedList();
List ll = new LinkedList(); // pour l'occurence
// pour éliminer les vides et des certains caractères
char ilimin [] = {' ',';','!','?',',',':','\'','"'};
int a=1 ;
for (int f=0; f< texte.length(); f++) {
for(int j=0 ; j< ilimin.length && a==1 ; j++)
if (texte.charAt(f) == ilimin[j]) a=0;
if (a==1) {
str+=texte.charAt(f);
}
if (a==0) { // if (str!="" && str.length()> 2) le bute est de éliminer les str vide et str < 2 comme va, a, ...
if (str!="" && str.length()> 2) { l.add(str.toLowerCase()); } str=""; a=1;
}
}
l.add(str.toLowerCase()); // pour dernier str
for(int vv = 0; vv < l.size(); vv++) // le bute est ordonnée les caractères
{ set.add(l.get(vv));}
int d=0 , occ=0;
Object[] obj = set.toArray();