Lets say I have a file like this:
'Line 1'
"Line 2"
"Line 3"
You have no choice but to read the file from the start until you get to the line you want.
(Unless the lines are all the same fixed length, in which case you can use a random access file and seek directly to the calculated offset of the desired line)
Read lines into an arrayList, access the arrayList.
Read the text file from BufferReader and check String contains from your search value...
Its a easy way to read the text file
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.