?
Solved

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

Posted on 2003-10-28
2
Medium Priority
?
367 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
[X]
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
2 Comments
 
LVL 86

Accepted Solution

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

Expert Comment

by:CEHJ
ID: 9633022
:-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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 will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

649 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