| | |
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,658
Reputation:
Solved Threads: 206
^ 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
Views: 1277 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for Java
911 addressbook android api append apple applet application arguments array arrays automation binary bluetooth character chat class classes client code component csv database detection draw eclipse error event exception file fractal ftp game givemetehcodez graphics gui helpwithhomework html ide image input integer j2me japplet java javaarraylist javaprojects jmf jni jpanel julia linux list loop map method methods mobile netbeans newbie number object objects oracle oriented os panel print problem program programming project projects recursion replaydirector reporting researchinmotion return robot scanner score screen se server set size sms socket sort sql stream string swing test threads time transfer tree ubuntu windows






