Integer and String pairing

shruts

Member
Joined
Sep 13, 2011
Messages
7
Programming Experience
1-3
Dear Reader,

I have a list of integer from 20000 to 30000 and each of the integers have a string message associated. How do I pair or extract string for the corresponding integer value?
 
10,000 rows of strings is a lot of data to hold in memory. I would use a database to hold that much data.

If I could not use a database then I would put all of the strings in a one-dimensional array. When a call came in for an item, say 24,568, I would subtract 20,000 from it and use that as the index to the array. So 24,568 would be the string at index 4568 in the array.
 
Doug,

This is the format: "29200: The axis object is invalid". It starts from 29200 and ends at 29499.

So if the software reads 29200 then I want to link this integer to the string "The axis object is invalid". And there are approx 500 of these integers with different string messages.
 
Read each line from list and split the string by ": ", put each key/value in a Dictionary.
 
Back
Top