• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in regex

 
Sidharth Khattri
Ranch Hand
Posts: 125
Java Linux Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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");

 
Henry Wong
author
Marshal
Pie
Posts: 21489
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sidharth Khattri
Ranch Hand
Posts: 125
Java Linux Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic