I have a textfile that I need to read each line separated by \n

Every 3 lines I need to reset the array

The textfile may contain 100-1000 lines and every 3rd line is a double while the rest are strings, then I need to take each cluster of 3 lines and input that into a database.

I have the database connection, I can read the entire file, I just can't figure out how to break the file into clusters of 3 lines...