Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
the regular expression package that Barry mentioned is only available with the latest JDK version -- 1.4.
This means that in your code, you are only using a space character as a delimiter. Using your example of '2003-1-2', you would be able to parse it by invoking the following:
StringTokenizer
public StringTokenizer(String str)Constructs a string tokenizer for the specified string. The tokenizer uses the default delimiter set, which is " \t\n\r\f": the space character, the tab character, the newline character, the carriage-return character, and the form-feed character. Delimiter characters themselves will not be treated as tokens.
Originally posted by Barry Gaunt:
Regular expressions?
That's the way to do it!![]()
Here.
-Barry
[ January 02, 2003: Message edited by: Barry Gaunt ]
Originally posted by Maulin Vasavada:
i mean reg exp and all would be too much work for nothing...
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
"I'm not back." - Bill Harding, Twister
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Don't get me started about those stupid light bulbs. |