Comparing strings by their alphabetical order

前端 未结 7 2156
灰色年华
灰色年华 2020-11-27 04:26
String s1 = \"Project\";
String s2 = \"Sunject\";

I want to compare the two above string by their alphabetic order (which in this case \"Project\"

7条回答
  •  死守一世寂寞
    2020-11-27 04:56

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

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

提交回复
热议问题