Sorting String[] with strings starting with capital letter and strings in lowercase

Posted on 2003-10-28
Last Modified: 2012-08-14
Just as the title trying to sort an array of strings. An example code follows :

String[] x = {"smithaj", "VMerve","albertd"};

The output I get from this would be:

It sorts the strings starting with capital letters first.. The result I want is:

I donot want to change the way the data is ie. change all strings to lowercase/uppercase.
Is there a way it will sort the data with ignoring the case?

Thank you in adavance.
Question by:ScarletBlue
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 86

Accepted Solution

CEHJ earned 20 total points
ID: 9632880
Arrays.sort(x, String.CASE_INSENSITIVE_ORDER);
LVL 86

Expert Comment

ID: 9633022

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Way to decrease size of apk file 9 112
Why my table column Id is not passed to java object? 4 46
Running JavaFX on JDeveloper 12C 1 79
ejb on wildfly 5 48
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question