Best way to parse a string with multiple repeating items
Posted on 2007-03-22
I am trying to parse repeating data that is in a byte array and wondering what would be the most efficient way to go about it.
example data in byte array
010107 Name jacksand Address 1000mainstreet City Madison State Wisconsin ZIP 12211,010107 Name rickLogan Address 1000mainstreet City SanDiego State California ZIP 12211
I was thinking of changing the byte array to a string
Using split to separate the two records
then indexOf to find where Name, Address, City, State, and Zip positions are in each of the string
then use substring to grab each
I think this may not be the best way to go about this?
Would you recommend keeping it in the byte array and using a StringBuffer?