Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: without using split method want to get data from config file having multiple values for single key, and want to store them in array

  1. #1
    Junior Member
    Join Date
    May 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default without using split method want to get data from config file having multiple values for single key, and want to store them in array

    can you please provide some code that how i can get the data from a file, for a key that have multiple values without using split method
    and i want to store that data in an array

    file name:"new.txt"[contains below data]

    Name=google.com, yahoo.com,facebook.com
    Attachment=abc1,abc2,abc3

    I am successfully able to do this using following code

    Properties props = new Properties();
    String configFilePath = (Cjava_confignew.txt);
    props.load(new FileReader(configFilePath));


    String TestName = props.getProperty(Name);
    String test[] = TestName.split(,);

    Now i just want to store the values for key "Name" in array without using TestName.split(,); but i am not able to do this.

    I have also used .yml file to avoid this but did not succeed please provide some way to do this

    file name test.yml

    Name
    -google.com
    -yahoo.com
    -facebook.com
    Attachment
    -abc1
    -abc2
    -abc3
    i want to store multiple values for single key(Name) within the array


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,105
    Thanks
    48
    Thanked 2,153 Times in 2,126 Posts

    Default Re: without using split method want to get data from config file having multiple values for single key, and want to store them in array

    but i am not able to do this.
    please explain and post the code you are having problems with.

    What is the reason for not using split()? The String class has methods that can be used to do the same thing as split.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Store data from Excel to Database without duplicate values
    By vector_ever in forum What's Wrong With My Code?
    Replies: 5
    Last Post: August 1st, 2013, 04:12 PM
  2. retrieving hashmap data in table format based key values
    By swapnareddy in forum JavaServer Pages: JSP & JSTL
    Replies: 4
    Last Post: April 16th, 2013, 08:48 AM
  3. retrieve data from database using Hashmap (multiple values in one key)
    By ashin12 in forum Collections and Generics
    Replies: 2
    Last Post: April 4th, 2012, 05:22 AM
  4. array to store multiple names and data
    By u-will-neva-no in forum Java Theory & Questions
    Replies: 2
    Last Post: May 6th, 2011, 05:03 AM
  5. Read A File and Store Values into a 2-Dimensional Integer Array?
    By Kimimaru in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 9th, 2011, 08:13 PM