File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Delimiter help please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Delimiter help please" Watch "Delimiter help please" New topic

Delimiter help please

Josh Mark

Joined: Mar 12, 2013
Posts: 2
Avengers,Joss Whedon,9.0
Panday,Carlo J. Caparas,6.9
Les Miserables,Tom Hooper,7.9

i'm suppose to add those above things from a text file to an arraylist.

and to add those to an arraylist the methods required goes at

I think here is my problem..

am i using the delimiter right to get the movie title, movie director, rating correct?
because of addMovie(String title, String director, double rating) . so if i want to add Avengers,Joss Whedon,9.0 should i use a delimeter
or is there an easier way..
Greg Charles

Joined: Oct 01, 2001
Posts: 2963

First, please UseCodeTags (⇐Click)

I would abandon the useDelimiter() method of Scanner. Instead read in a whole line (which you are doing already) and use the split() of the String class to divide the line into pieces.
It is sorta covered in the JavaRanch Style Guide.
subject: Delimiter help please
It's not a secret anymore!