Java Array Sort sortStringArrayAlphabetically(String[] strings)

Here you can find the source of sortStringArrayAlphabetically(String[] strings)

Description

sort String Array Alphabetically

License

Open Source License

Declaration

public static void sortStringArrayAlphabetically(String[] strings) 

Method Source Code

//package com.java2s;
//License from project: GNU General Public License 

public class Main {
    public static void sortStringArrayAlphabetically(String[] strings) {
        int j;//from   w  ww  .ja v a 2 s.c o m
        boolean notDone = true; // will determine when the sort is finished
        String temp;
        while (notDone) {
            notDone = false;
            for (j = 0; j < strings.length - 1; j++) {
                if (strings[j].compareToIgnoreCase(strings[j + 1]) > 0) { // ascending sort
                    temp = strings[j];
                    strings[j] = strings[j + 1]; // swapping
                    strings[j + 1] = temp;
                    notDone = true;
                }
            }
        }
    }
}

Related

  1. sortReverseOrder(String[] strings)
  2. sortStringArray(String array[], boolean inplace)
  3. sortStringArray(String[] array)
  4. sortStringArray(String[] array)
  5. sortStringArray(String[] source)
  6. sortStrings(final String[] strings)
  7. sortStrings(String[] strings)
  8. sortStrings(String[] strings)
  9. sortStrings(String[] strings)