| | |
Finding alphabets in a string
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
only the alpha characters?
so H3ll0 Wor7D would print out:
H
l
l
W
o
r
D
that's easy enough to do using regular expressions.
the [a-zA-Z] searches for all characters within the range of a-zA-Z. You can then use the regexp to output the matches...etc
so H3ll0 Wor7D would print out:
H
l
l
W
o
r
D
that's easy enough to do using regular expressions.
the [a-zA-Z] searches for all characters within the range of a-zA-Z. You can then use the regexp to output the matches...etc
Last edited by Killer_Typo; Mar 25th, 2009 at 3:49 pm.
Dont forget to spread the reputation to those that deserve!
•
•
Join Date: Sep 2008
Posts: 1,598
Reputation:
Solved Threads: 202
^ No, he's saying only to print out the character the first time it is seen.
RealThinkers, what you should do is make an array of 26 booleans, one for each letter in the alphabet. True means it has been seen, false means it hasn't. Then when you see a character, if it is a letter, check the corresponding index to see whether or not it has been seen yet. Make sure to set it to 'seen'/true after you see the char for the first time.
RealThinkers, what you should do is make an array of 26 booleans, one for each letter in the alphabet. True means it has been seen, false means it hasn't. Then when you see a character, if it is a letter, check the corresponding index to see whether or not it has been seen yet. Make sure to set it to 'seen'/true after you see the char for the first time.
•
•
•
•
^ No, he's saying only to print out the character the first time it is seen.
RealThinkers, what you should do is make an array of 26 booleans, one for each letter in the alphabet. True means it has been seen, false means it hasn't. Then when you see a character, if it is a letter, check the corresponding index to see whether or not it has been seen yet. Make sure to set it to 'seen'/true after you see the char for the first time.
•
•
•
•
it count character only once
Dont forget to spread the reputation to those that deserve!
![]() |
Similar Threads
Other Threads in the Java Forum
- Previous Thread: Going from Java to Obj-C (need hlp in transition)
- Next Thread: Encrypting a media file
| Thread Tools | Search this Thread |
3d @param affinetransform android api applet application arc arguments array arrays automation binary bluetooth byte capture chat class classes click client code color compare component count database design detection eclipse eclipsedevelopment encryption error event exception fractal game givemetehcodez graphics gridlayout gui guitesting helpwithhomework html ide if_statement image input integer j2me java java.xls javaprojects jni jpanel julia keytool keyword linux list loop macintosh map method methods mobile netbeans newbie object os pong print problem producer program programming project projectideas read recursion replaysolutions rim scanner screen server set size sms sort sql string swing terminal threads time transforms tree ui web windows






