This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
String input = "1 fish 2 fish red fish blue fish";
Scanner s = new Scanner(input).useDelimiter("\\s*fish\\s*");
output is :
Can anyone help me in understanding how the output has come? I have not understood the core thing:
" ("\\s*fish\\s*"); "
what is the meaning of \s,\d??
I have taken a look and tried some examples. So in the above example:
This string is treated as the delimiter: "zero or more times white space, then word fish, then zero or more white spaces".
Am I right?