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

  • Home
  • SEARCH
  • 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 8965897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:54:37+00:00 2026-06-15T16:54:37+00:00

I have CSV file which contains 6 column separated by comma: VendorCode, VendorName, Material,

  • 0

I have CSV file which contains 6 column separated by comma:

VendorCode, VendorName, Material, MaterialDescription, Reason, Quantity    

I am able to retrieve data from each column except “Reason” column as it contains values in that column as:

Pitted, Rusty     

( I mean comma separated values are there in that column)

(So Pitted value is inserted in “Reason “ arraylist & Rusty is inserted in “Quantity” arraylist For that particular line)

For eg: :

One row of csv file contains:

AA90,ABC LTD.,2.71E+11,ASSY/LAM`E'CE-MSSL-RINDER,"VisualCrack,B.H,Damage,Burr",330

DESIRED OUTPUT :
“pitty,rusted” should be treated as single string and stored in database

i have tried this

while ((thisLine = myInput2.readLine()) != null)  {

    String[] str = thisLine.split(",");
    for(int j=0; j<str.length; j++) {
        switch(j) {
            case 0: DR_VendorCode.add(str[j]);//getContents()); break;
            case 1:DR_VendorName.add(str[j]);//getContents()); break;
            ....
        }

        i1++;
    }
}

for(int k=0;k<DR_VendorCode.size()+1;k++) {

    String DR_VCODE=DR_VendorCode.get(k).toString();
    String DR_VNAME=DR_VendorName.get(k).toString();
    ....
}
  • 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-15T16:54:38+00:00Added an answer on June 15, 2026 at 4:54 pm

    Here you go …

    String regex = "\"[^\"]+\"|[^,]+";
    Pattern p = Pattern.compile(regex);
    Matcher m = p.matcher(thisLine);
    while(m.find()) {
        System.out.println(thisLine.substring(m.start(),m.end()));
        // I suppose you could construct an array here rather than just printing it
    }
    

    Output …

    AA90
    ABC LTD.
    2.71E+11
    ASSY/LAM`E'CE-MSSL-RINDER
    "VisualCrack,B.H,Damage,Burr"
    330
    

    To handle 5th (actually any but only one) column with multiple embedded quotes …

    String regex = "\".*\"|[^,]+";
    

    Output …

    AA90
    ABC LTD.
    2.71E+11
    ASSY/LAM`E'CE-MSSL-RINDER
    "VisualCrack,B.H,"Damage",Burr"
    330
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV (comma separated values) file that contains student information. The column
I have a csv file which contains 2000 data in one single column. The
I have a csv file which contains a column named query. One of the
Suppose we have a csv file(>5GB) which contains Employee name and Age column. The
I have a Testing project that contains a csv file which a webtest uses
I have a CSV file which contains numbers,date and text. I have to extract
I have a CSV file the first row of which contains the variables names
I have a CSV file the first row of which contains the variables names
I have a CSV file which contains an ID and several other columns. I
I have a package which contains a csv file which I put in inst/extdata

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.