my dog learned polymorphism*
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 Android Security Essentials Live Lessons this week in the Android 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: 38075
    
  22
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: http://aspose.com/file-tools
 
subject: Generate mixed cases of a word
 
Similar Threads
test case for servlets
generate data population source code for junit?
eclipse and junit - how to generate report?
Why can't I code?
Dependency Inversion Principle