Jan 21, 2004 #1 jl3574 Programmer Joined Jun 5, 2003 Messages 76 Location CA i'm trying to tokenizer a date within a text example if a text contain "today's date is 01-22-1998 tommorrow's date is 01-23-1998" i want to pull out the date as tokens so i want the tokens to be 01-22-1998 01-23-1998 plz help thx
i'm trying to tokenizer a date within a text example if a text contain "today's date is 01-22-1998 tommorrow's date is 01-23-1998" i want to pull out the date as tokens so i want the tokens to be 01-22-1998 01-23-1998 plz help thx
Jan 21, 2004 #2 Cagliostro Programmer Joined Sep 13, 2000 Messages 4,226 Location GB I believe, right direction is to use regular expressions. Ion Filipski Upvote 0 Downvote
Jan 26, 2004 #3 jstreich Programmer Joined Apr 20, 2002 Messages 1,067 Location US indeed... I think you'll have to run a loop through the string and use the match function.... Code: for(st = new StringTokenizer(string," "); st.hasNextToken();) { String current = st.nextToken(); if(current.match("//d//d-//d//d-//d//d//d//d") { Code: //do stuff Code: } } Upvote 0 Downvote
indeed... I think you'll have to run a loop through the string and use the match function.... Code: for(st = new StringTokenizer(string," "); st.hasNextToken();) { String current = st.nextToken(); if(current.match("//d//d-//d//d-//d//d//d//d") { Code: //do stuff Code: } }