How can I sort strings in multiple languages?

How to sort a strings array in java?

  • Strings[] ids = {"123A", "122A", "110A", and "410A"} and i need to sort this array from lowest to highest. Any ideas how i could approach this? ...show more

  • Answer:

    Use the string compareTo and compareToIgnoreCase functions when you are making the comparisons: String str1 = "abc"; String str2 = "def"; if( str1.compareTo( str2 ) < 0 ) ... System.out.println( "str1 comes before str2" ); http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#compareTo(java.lang.String)

3YR76ARZ3KBVM7LK5ETFK7VYCE at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.