• Post Reply Bookmark Topic Watch Topic
  • New Topic

Strings in alphabatic order  RSS feed

 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we print a given string in alphabetic order of the character of that given string.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
James Bellan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...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
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all.I solved it by using Array.sort().
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!