+ 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?

5th Oct 2017, 8:44 AM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
2 Respostas
+ 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
5th Oct 2017, 9:40 AM
D_Stark
D_Stark - avatar
+ 2
@David thanks!!!
6th Oct 2017, 1:37 PM
cHiRaG GhOsH
cHiRaG GhOsH - avatar