Results 1 to 3 of 3
Thread: identify the delimiter..
- 09-28-2011, 09:25 AM #1
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
identify the delimiter..
Dear friends
Could you help me with the following
I am working with the stringtokenizer.
I would like to write the query based on the delimiter.for ex:
if user enter 1-5 , i need to search the values in the the range between 1 and 5.
if user enter 1,3. i need to search the values for 1 and 3
How can I do this using stringtokenizer or there is anyother way to proceed.
writing the query is not the prob, but how can i identify the delimiter.
thank you in advance
- 09-28-2011, 02:44 PM #2
Re: identify the delimiter..
What is the pattern for the input?
<numeric digit(s)><single delimiter char><numeric digit(s)>
You might be able to use a regular expression to parse this. I'm not much with regex's so I'll leave this to some one that is.
- 09-28-2011, 05:16 PM #3
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Re: identify the delimiter..
StringTokenizer (Java Platform SE 6)
StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code.
I`m not sure if I understood you correctly:
???Java Code:String s = "The 1st example line. The 2nd one. The 6th line."; String one = "1-7"; String two = "1,6"; Matcher m = Pattern.compile("["+one+"]").matcher(s); while(m.find()){ System.out.println(m.group()); } System.out.println("----"); m = Pattern.compile("["+two+"]").matcher(s); while(m.find()){ System.out.println(m.group()); }
Similar Threads
-
How to identify a roman numeral
By dunworry in forum New To JavaReplies: 13Last Post: 12-19-2010, 08:13 AM -
Identify pixel in the image.
By Maiquelnet in forum Java 2DReplies: 2Last Post: 11-12-2009, 07:55 PM -
How to identify packet type?
By priya deshpande in forum NetworkingReplies: 0Last Post: 10-11-2009, 06:40 AM -
delimiter
By satin in forum New To JavaReplies: 2Last Post: 11-17-2008, 10:50 PM -
identify a thread
By valery in forum Advanced JavaReplies: 1Last Post: 07-25-2007, 01:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks