Solved

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

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

String[] x = {"smithaj", "VMerve","albertd"};
Arrays.sort(x);

The output I get from this would be:
VMerve
albertd
smithaj

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

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.
SB
0
Comment
Question by:ScarletBlue
  • 2
2 Comments
 
LVL 86

Accepted Solution

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

Expert Comment

by:CEHJ
ID: 9633022
:-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
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 the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

808 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