Sort array values in case insensitive order : String sort « Data Type « Java






Sort array values in case insensitive order

 
 
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    String[] teams = new String[5];
    teams[0] = "M";
    teams[1] = "c";
    teams[2] = "A";
    teams[3] = "l";
    teams[4] = "E";

    Arrays.sort(teams);
    System.out.println(Arrays.toString(teams));
    Arrays.sort(teams, String.CASE_INSENSITIVE_ORDER);
    System.out.println(Arrays.toString(teams));
  }
}

   
  








Related examples in the same category

1.StrSortCase demonstrates sorting of strings usingStrSortCase demonstrates sorting of strings using
2.Sorting a string List
3.String.CASE_INSENSITIVE_ORDER