• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generate mixed cases of a word

 
Chethan Sharma
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

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

Please let me know .

Thanks,
Rams
 
Campbell Ritchie
Sheriff
Pie
Posts: 49796
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried changing your String to a char[] array and using the toLowerCase and toUpperCase methods of Character?
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic