hi i need to convert my comma seperated text file in to a two dimensional array and i should be able to access each element in that array....i tried so many programs based on read line and split functions but i didn't get the proper output....please help me to do this..

Recommended Answers

All 5 Replies

Please post the code you are having problems with, your questions and the full text of the error messages.

you could do what your doing right now or you could a csv library
just google csv for java

Post the work you have done so far.

What you could do is read the file, line by line into a String. Then use split to remove the commas and put it into an array.

String line = "Apples,bananas,oranges";
String[] dataArray = line.split(",");          

The above uses a simple array, but it should be easy enough to put it into a matrix.

If you're using NIO, and the file is small, there is also readAllLines method to consider.

Hi,
I have a doubt as if i have a "xml format" text message in my email body then how can i cobert it into an array so that i can fetch each node form it
for example:
my email body containts xml format:

<?xml version="1.0" ?>
<candidate>
    <name>Superduper automation</name>
    <email>yogesh@gmail.com</email>
    <explevel>1</explevel>
    <skillset>super automation</skillset>
    <track>Tester</track>
</candidate>

like this.
now I want to fetch <name> , <email> etc values seperatly. so how can i do that?
(dont forget that xml code is in my email body part!)

PritiP
Please read the DaniWeb member rules before posting - it helps to keep our web site well-organised.

DaniWeb Member Rules include:
"Do not hijack old threads by posting a new question as a reply to an old one"
http://www.daniweb.com/community/rules
Please start your own new thread for your question

This thread is closed. Please re-post your question as a new discussion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.