0

Hello I need help. I need to write a program that changes all upper case letters to lower case letters and all lower case letters to upper case then the vowels with an *...

it would look like this

normal= UppER loweR caSe

output should be this..

*PP*r L*W*r C*s*..

i already know how to change all lower case to upper case and vice versa if it's a sentence..but i don't know how to do it per letter..

can anyone pls help me..:cheesy:plzzzzz

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by jwenting
0

You have to analyze the input one character at a time...

Say we have a string: myString

Set up a for loop with a lower limit of 0 and an upper limit of myString.length()-1 inclusive

Read each character one at a time with myString.charAt(int index) Analyze the single character. What is it? A vowel? Upper-case? Lower-case?

Append the new character to another string / a buffer.

Next character in the loop...

There are other ways to do this, but the above should work for general purpose.

0

Easiest (and fastest) is to use regular expressions to replace all uppercase letters with an asterisk, then call toUppercase() on the resulting string.
Far more elegant (and possibly faster, especially with long strings) than looping through every character.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.