File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Generate mixed cases of a word Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Generate mixed cases of a word" Watch "Generate mixed cases of a word" New topic
Author

Generate mixed cases of a word

Chethan Sharma
Ranch Hand

Joined: Mar 22, 2006
Posts: 59
Hi,

How do I generate different cominations/ mixed cases of a word.

Eg: Test
TEST
TEst
TESt
TesT
...............

Please let me know .

Thanks,
Rams


chaithu
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38509
    
  23
Have you tried changing your String to a char[] array and using the toLowerCase and toUpperCase methods of Character?
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
You could loop through the string, then for each character, you use a random generator to determine 1 or 0, then invoke the toLowerCase or toUpperCase method.


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Generate mixed cases of a word