| Author |
Strings in alphabatic order
|
Ashok Pradhan
Ranch Hand
Joined: Dec 17, 2007
Posts: 179
|
|
|
can we print a given string in alphabetic order of the character of that given string.
|
 |
Nitesh Kant
Bartender
Joined: Feb 25, 2007
Posts: 1638
|
|
Originally posted by Ashok Pradhan: can we print a given string in alphabetic order of the character of that given string.
Yeah sure, you can. Have you tried something and it did not work? Just trying to find out whether you have read this FAQ entry: Show some effort
|
apigee, a better way to API!
|
 |
James Bellan
Greenhorn
Joined: Nov 05, 2007
Posts: 9
|
|
Hi Ashok, Here is the program you can use to sort the string. [ code deleted - Jim ] Cheers, J2G. [ January 24, 2008: Message edited by: Jim Yingst ]
|
 |
Nitesh Kant
Bartender
Joined: Feb 25, 2007
Posts: 1638
|
|
Well Navin, We do not just post code if it looks like that there has been no effort shown before posting the code. This is a javaranch policy. Using Collections.sort() or Arrays.sort() will give the desired result as the natural-ordering of strings is alphabetical.
|
 |
Mark Newton
Ranch Hand
Joined: Jan 31, 2006
Posts: 129
|
|
...also, when you *do* post code, you'll find that the [code] tags make it much more readable, and therefore easier for the person you're trying to help, understand for next time... You might like to review HowToAnswerQuestionsOnJavaRanch.
|
 |
Ashok Pradhan
Ranch Hand
Joined: Dec 17, 2007
Posts: 179
|
|
|
Thanks to all.I solved it by using Array.sort().
|
 |
 |
|
|
subject: Strings in alphabatic order
|
|
|