Journal DLFP et CSS alternatives
Ca en est où ?
import java.util.Locale;
import java.util.ArrayList;
import java.util.Collections;
import java.text.Collator;
public class Test {
public static void main(String[] args) {
Collator lCollator = Collator.getInstance(Locale.FRENCH);
ArrayList lList = new ArrayList();
lList.add("raté");
lList.add("rate");
lList.add("Raté");
lList.add("Ratiboisé");
lList.add("Albert Einstein");
lList.add("aliment");
lList.add("Zorro");
lList.add("Albert");
lList.add("Ratés");
lCollator.setStrength(Collator.PRIMARY);
Collections.sort(lList, lCollator);
System.out.println("Tri : \n" + lList);
lCollator.setStrength(Collator.SECONDARY);
Collections.sort(lList, lCollator);
System.out.println("Tri : \n" + lList);
lCollator.setStrength(Collator.TERTIARY);
Collections.sort(lList, lCollator);
System.out.println("Tri : \n" + lList);
lCollator.setStrength(Collator.IDENTICAL);
Collections.sort(lList, lCollator);
System.out.println("Tri : \n" + lList);
}
Tri :
[Albert, Albert Einstein, aliment, (…)