File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Node.js in Action
this week in the
How to sort String, for example: abced. to change to abcde
Joined: Jul 25, 2008
Aug 22, 2008 05:43:00
i am beginners in
, i have proble to sorting a
for example how we sort abecd into abcde in java
Joined: Jun 06, 2007
Aug 22, 2008 05:57:00
Let us know how far have you gone with the problem.
Hint:You can use the charAt() method and any sorting mechanism you wish to implement.
Asking Good Questions
Joined: Feb 25, 2006
Aug 22, 2008 05:58:00
1 - create an array of characters from String X;
2 - sort the character array;
3 - create a new String from the sorted array;
4 - reassign X to the newly created String;
5 - have a beer... err... cup of coffee!
Have a look at the String- and Arrays API docs for steps 1, 2 and 3:
Joined: Oct 02, 2003
Aug 22, 2008 05:59:00
Is this a homework assignment? What have you tried? are you allowed to use all the tools in the api, or do you have to write your own sort?
I'd strongly recommend you read our
to get the most out of the JavaRanch.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I agree. Here's the link:
subject: How to sort String, for example: abced. to change to abcde
Java String pool problem
Passed SCJP 1.2
References in JAVA
Refering variables of class which extends applet
is there a sizeof() in Java?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014