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 8958491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:13:31+00:00 2026-06-15T15:13:31+00:00

I have an array that is from .split command and want to put it

  • 0

I have an array that is from .split command and want to put it into an array called String[][] datatabvars, I do not know how to turn datatabvars into a two dimensional array and put the data into it.

public String[] getList() {
    String file_name = "path";
    String[] links = null;
    String[][] datatabvars = null; // this var
    int numberOfDatatabs = 0;
    try {
        ReadFile file = new ReadFile(file_name); 
        String[] aryLines = file.OpenFile();

            int i;
        for(i=0; i < aryLines.length; i++) { //aryLines.length
            if (aryLines[i].substring(0, 7).equals("datatab")) {
                aryLines[i] = aryLines[i].replace("datatab["+Integer.toString(numberOfDatatabs)+"] = new Array(", "");
                aryLines[i] = aryLines[i].replace(");", "");
                datatabvars = aryLines[i].split(","); // this split array
                numberOfDatatabs++;
            }
        }
        System.out.println(datatabvars[0]);
    }catch (IOException e) {
        System.out.println( e.getMessage() );
    }
    return links;
}
  • 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-15T15:13:32+00:00Added an answer on June 15, 2026 at 3:13 pm

    In general, arrays are to avoided like the plague – use collections if possible:. In this case, split() returns a String[], so use that, but use List<String[]> to store multiple String[]:

    List<String[]> datatabvars = new ArrayList<String[]>();
    ...
    String[] array = input.split(",");
    datatabvars.add(array);
    

    You find life is much easier using collections than arrays.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Array of Strings that was split from a buffer string. Now
I have string that look like Array that fetched from other webservice like this
What I'm looking to do is split data from string into an array. Here's
I have a large array in PHP. It contains strings that are split into
I have a String Array which is contain dates that read from a CSV
I have a 2D array that I have split up into several 1D arrays
I have a Long string from that I want to store the keyword in
I have an array that is produced from people wanting to reserve a time
I have an array that is taken from an image using exif_read_data($image, 0, true)
I have a Knockout observable array that I wish to edit from within Javascript

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.