Answers for "sort array with case insensitive"

1

Sort string array in case insensitive order and case sensitive order java

import java.util.Arrays;
public class SortStringArrayDemo
{
   public static void main(String[] args) 
   {
      String[] fruits = new String[5];
      fruits[0] = "Mango";
      fruits[1] = "cherries";
      fruits[2] = "Apple";
      fruits[3] = "lychee ";
      fruits[4] = "Elderberry";
      Arrays.sort(fruits);
      System.out.println("CASE SENSITIVE ORDER : ");
      System.out.println(Arrays.toString(fruits));
      Arrays.sort(fruits, String.CASE_INSENSITIVE_ORDER);
      System.out.println("CASE INSENSITIVE ORDER : ");
      System.out.println(Arrays.toString(fruits));
   }
}
Posted by: Guest on November-02-2020

Code answers related to "sort array with case insensitive"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language