i keep forgetting to write back to thank people for helping me... didn't want to bring back the topic. Thanks to all!!
I'm having trouble with a program. I'm basically checking to see that a SSN is inserted correctly into this format "DDD-DD-DDDD." If its not in that format, then it returns false. My question is, what kind of method or constructor do I use to even begin? I'm having trouble finding one that points me into a direction. My initial thought is to have a method where it checks whether the fourth and seventh character has "-" and make sure the string has a length of 11 characters. But its the method to check for this "-" that i don't know what to do. I've looked at all the java.lang.String, Character, and StringBuilder and none of them seems to fit. A moose kick in the right direction will help out a lot so i could look into it!
Thanks John! I feel you should be wearing a cape. The wheels are definitely turning!!! Now let me ask you this or anyone who is reading... the problem states that the user inputs the SSN number... and it also says to assume that 'D' is an interger. I am not sure if he was hinting at something there... is there a way to recognize the 'D' as any integer?
As an example: "434-23-4953".matches("DDD-DD-DDDD"); where 'D' can be any integer. Is there a method that will do that? or is there another way to approach it!?
***** Thinking to myself ***** wait... what if i used the replaceAll method to replace any integer to the letter 'D' and then use the matches method to to compare both strings....
HA!!! I DID IT !!! lol... wow... that was pretty easy!! thanks again John!!!
Problem... I am not seeing whats wrong here. if i put in a set string, it returns true. however from the user's input, it returns false. ummm... why?