+ 5
[Java] How to put delimiter in the Scanner class ?
By default the scanner class excepts data from its source in form of tokens. These tokens are separated by whitespace. However, we can set our own delimiter other than whitespace. So my question is how to set the delimiter. I know the syntax :- useDelimiter(String pattern) or useDelimiter(Pattern pattern). I can't understand the argument which needs to be given i.e. the pattern. How is the pattern formed?
2 Antworten
+ 6
Hey, i had this bookmarked for one of many things to learn not sure if its somthing that might help theres a good link example of initializing the delimiter method with step by step notes.
https://stackoverflow.com/questions/28766377/how-do-i-use-a-delimiter-in-java-scanner
+ 2
@David thanks!!!