File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes code to find out all combinations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "code to find out all combinations " Watch "code to find out all combinations " New topic

code to find out all combinations

pavanb kumar

Joined: Mar 09, 2004
Posts: 2
I want code to find out all combinations of a word

for eg., if i have a word ABCD,then i have to find out all the combinations of this word like AB,AC,ABD.

Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Since this doesn't have anything specifically to do with Swing/JFC/AWT GUI stuff, I'm moving this post to the Java In General (Beginner) forum.

(In addition, this sounds suspiciously like a homework problem... and there's a difference between asking "Give me some suggestions/hints/pointers on how to do X" and "Post the code for X so I can cut and paste it into my homework". I'll give a hint... this involves loops and methods on the String class.)

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
What have you tried up to this point? If you can give us an idea of where you would like to start, we can give feedback on where to go from there.

Java API Documentation
The Java Tutorial
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Here's something to play around with - it will gaive all combos, including
single characters - modify to suit
I agree. Here's the link:
subject: code to find out all combinations
It's not a secret anymore!