aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Problem in regex Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Problem in regex" Watch "Problem in regex" New topic
Author

Problem in regex

Sidharth Khattri
Ranch Hand

Joined: Sep 16, 2013
Posts: 121

Question is from CertPal
Though I've read about invocation of useDelimiter() on Scanner, but I don't know about Scanner.delimiter() and I couldn't find it.
It's used in this program(highlighted with a comment).
Does scanner.delimiter() return an instance of Pattern? If yes, what is the argument in that Pattern's instance?
I only knew the following way to instantiate Pattern:
Pattern p = Pattern.compile("\\d");



OCPJP 6 - 96%
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

Sidharth Khattri wrote:
Though I've read about invocation of useDelimiter() on Scanner, but I don't know about Scanner.delimiter() and I couldn't find it.


Generally, the javadoc is a good place to start, when searching about methods -- see java.util.Scanner. And yes, it returns the pattern that is being used as a delimiter.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Sidharth Khattri
Ranch Hand

Joined: Sep 16, 2013
Posts: 121

Henry Wong wrote:
Sidharth Khattri wrote:
Though I've read about invocation of useDelimiter() on Scanner, but I don't know about Scanner.delimiter() and I couldn't find it.


Generally, the javadoc is a good place to start, when searching about methods -- see java.util.Scanner. And yes, it returns the pattern that is being used as a delimiter.

Henry


Thank you Henry. Really appreciate your help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in regex