Results 1 to 9 of 9
Thread: changing letters in strings
- 02-17-2011, 05:31 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 32
- Rep Power
- 0
- 02-17-2011, 05:34 AM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
You can add numbers to a character, so if you have char 'a' and add 2 it should produces char 'c'. So you just need to use if statements to check if an item is a vowel and change if it is.
- 02-17-2011, 05:56 AM #3
Member
- Join Date
- Feb 2011
- Posts
- 32
- Rep Power
- 0
how can I do this in a string?
- 02-17-2011, 05:58 AM #4
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
string.charAt(index)
for example
Java Code:String hi = "hi"; hi.charAt(0); //'h' hi.charAt(1); // 'i'
- 02-17-2011, 06:00 AM #5
Member
- Join Date
- Feb 2011
- Posts
- 32
- Rep Power
- 0
well in my case since the user input a string, would i use a counter to go through the string to find the vowels? if so how can i tell the counter when it reaches the end of the string?
- 02-17-2011, 06:07 AM #6
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Do you know how to use for loops yet?
- 02-17-2011, 06:50 AM #7
Use the String.length() method for this. Something like,
Java Code:String s = "test"; for (int i = 0; i < s.length(); i++) { // Your logic }
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 02-17-2011, 01:41 PM #8
Member
- Join Date
- Feb 2011
- Posts
- 32
- Rep Power
- 0
bump help pls
- 02-17-2011, 01:56 PM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
Changing binding when changing the underlying model object
By ChrisNY in forum NetBeansReplies: 0Last Post: 08-14-2010, 10:09 AM -
What does the letters mean?
By mustachMan in forum New To JavaReplies: 3Last Post: 02-11-2010, 09:50 PM -
Need help with counting letters
By mrdestroy in forum New To JavaReplies: 15Last Post: 10-22-2008, 01:33 PM -
text Strings to produce letters
By dc2acgsr99 in forum New To JavaReplies: 7Last Post: 01-29-2008, 08:08 PM -
need block letters??
By dc2acgsr99 in forum New To JavaReplies: 16Last Post: 01-29-2008, 08:31 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks