Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8643727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:07:21+00:00 2026-06-12T12:07:21+00:00

I am trying to take an ArrayList of strings and separate it so that

  • 0

I am trying to take an ArrayList of strings and separate it so that i can extract a title from each line.

Here is the contents of the ArrayList:

Tom Sawyer;Twain, Mark;1972;8.50;f;
Leaves of Grass;Whitman, Walt;1975;29.99;p;
Romeo and Juliet;Shakespeare, William;1980;4.99;d;
Great Gatsby;Fitzgerald, F. Scott;1979;5.99;f;
Scarlet Letter;Hawthorne, Nathaniel;1981;4.78;f;
Whisper of the River;Sams, Ferrol;1984;21.95;f;
Moby Dick;Melville, Herman;1962;13.98;f;
Last of the Mohicans;Cooper, James Fenimore;1968;8.75;f;
Odyssey;Homer;1950;9.99;f;
Christmas Carol;Dickens, Charles;1966;12.50;f;
Les Miserables;Hugo, Victor;1988;19.98;f;
Heart of Darkness;Conrad, Joseph;1970;14.45;f;
Animal Farm;Orwell, George;1978;10.00;f;
Canterbury Tales;Chaucer, Geoffrey;1965;20.00;d;
Old Man and the Sea;Hemingway, Ernest;1966;9.95;f;

I need to make a method or something that gets the first part of the line up until the “;”.

Here is the code I was using for something similar except this is reading a data file:

while (datascanner.hasNext())
File datafile = new File (data name)
Scanner datascanner = new Scanner(datafile)
String data = datascanner.nextLine()
StringToeknizer dataParser = new StringTokenizer(data, ";")
String title = dataParser.nextToken()

I need something similar to this but instead it searches the arraylist and not the file. I will then extract the other contents on each line:

String author = dataParser.nextToken()
int CopyR = dataParser.nextToken()

and so on…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:07:22+00:00Added an answer on June 12, 2026 at 12:07 pm

    Just iterate through the list and apply your logic

    for(String line : myArrayList)
    {
        StringTokenizer st = new StringTokenizer(line, ";");
        String author = st.nextToken();
        //etc.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to take in several file names from the user at the command line
net I am trying to take a value from a previous form typically in
I have a program that I am trying to take a set of numbers
I'm at a lose with this one. Trying to take edittext from a list
I'm trying take the names that I am given by the program after it
I am trying to take an array that contains 400 integers, and split it
I'm trying to call a command-line application (let's call it SomeTerminalApp ) from Java,
I am trying to writing code so that my android application can query a
I am trying to take a start date and and end date from a
I am trying to Add and delete from an arraylist of a collection of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.