Im taking a java class right now but I am still a complete noob.
I want to make a program where it searches a text file and will write the usernames it finds to a new text file.
Usernames are always found like this in the file...

 <a href="/user/iEpic"

the iEpic would be the username I want to write to a new text file.
I don't expect anyone to write this for me, I just have no idea where to start and need a little push into the right direction.
Thanks!

Recommended Answers

All 2 Replies

write this for me, I just have no idea where to start and need a little push into the right direction.
Thanks!

are we talking html files?
in that case, look for a html parser in java

You can open the file. In a loop read each line into a String. Use indexOf to find the <a href="/user/ text. If it's there use indexOf again to find the end of the user name. Use substring to extract the part of the string that contains the user name. Write that to the new file

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.