About Java Scanner

Asked 2 years ago, Updated 2 years ago, 25 views

IPHONE 7, 4.7, A10, GSM, JET BLACK, 32GB, TRUE, 700
IPAD AIR 2, 9.7, A8, TRUE, SILVER, 64GB, 400

I would like to read the above sentences one letter at a time using Scanner.delimiter(","), but at the end of the sentence, the line changes like 700 IPAD AIR2, but reads them.How can I avoid switching to the end?

java

2022-09-29 22:45

1 Answers

Please also add a new line to the delimiter.

useDelimiter(", |\n")


2022-09-29 22:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.