Makky Makky - 6 months ago 50
Java Question

Comparing strings by their alphabetical order

String s1 = "Project";
String s2 = "Sunject";

I want to compare the two above string by their alphabetic order (which in this case "Project" then "Sunject" as "P" comes before "S").
Does anyone know how to do that in Java?


String.compareTo might or might not be what you need.

Take a look at this link if you need localized ordering of strings.