0

I have an array named "testArray" with elements: {"fdvsd","sd","Edit1648004502584","zxz","automatioion","acas","teg"}

Once I use Arrays.sort(testArray), the elements are sorted as below: {"Edit1648004502584","acas","automatioion","fdvsd","sd","teg","zxz"}

But I need the array to be sorted as follows: {"acas","automatioion","Edit1648004502584","fdvsd","sd","teg","zxz"}

Please help me out.

Yogesh
  • 3
  • 2

1 Answers1

1

If I understand correctly the issue you are having is the capitalisation of the Strings, when you want it to ignore case. Try the following code:

Arrays.sort(testArray, String::compareToIgnoreCase);
MorganS42
  • 656
  • 4
  • 21