if looping in parsing string data

Then both functions will be easier to debug and extend to meet future requirements.

And, you can wait to call the function that uses the data until you have all the data for it to use.