I have a tab delimilated txt file. how can i read only the second part of the file. ex

10.0.0.0 hostname date

i want to read in the hostname only

what function can i use to do this?

Recommended Answers

All 5 Replies

You can use a Scanner or the String.split() function.

String.split(" ") doesnt work. what would the syntax for the tab deliminater be?

"\t" is the tab character.

it works with 1 part, but when i put it into an arraylist, it wont compile

for (int i = 0; i<FileList.size(); i++)
        { 
            
            System.out.println(FileList.get(i).split("\t"));
        }

Well, I would imagine it told you why as well, rather than simply stating "This won't compile".

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.