•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 426,197 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,839 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 828 | Replies: 2
![]() |
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
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
You have to analyze the input one character at a time...
Say we have a string: myStringThere are other ways to do this, but the above should work for general purpose.
Set up a for loop with a lower limit of 0 and an upper limit ofmyString.length()-1inclusive
Read each character one at a time withmyString.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...
Last edited by Cudmore : Feb 17th, 2007 at 9:57 am.
synchronized (theWorld) { System.out.println ("It's all mine..."); }
How many people have code in their Sigs?
How many people have code in their Sigs?
•
•
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation:
Rep Power: 18
Solved Threads: 199
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.
Far more elegant (and possibly faster, especially with long strings) than looping through every character.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Help needed in graphics.h (C++)
- Java tutor needed BADLY (Java)
- My story, funny hardware, and the ghost in the machine. (Motherboards, CPUs and RAM)
- Need help on homework (C++)
- help me on my case study!!! (C)
- Recursive help needed badly! (Java)
Other Threads in the Java Forum
- Previous Thread: hey guys i need help to
- Next Thread: word counter, frequency, percentage



Linear Mode