File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "Generate mixed cases of a word" Watch "Generate mixed cases of a word" New topic

Generate mixed cases of a word

Chethan Sharma
Ranch Hand

Joined: Mar 22, 2006
Posts: 59

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

Eg: Test

Please let me know .


Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46353
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
I agree. Here's the link:
subject: Generate mixed cases of a word
It's not a secret anymore!