Alright, so I have a text file with some data in it, in this format:
Info1-Info2
Info3-Info4
Info5-Info6
With my program, I would like to be able to get the contents of a line, based on the first piece of information I give. So, if I give “Info3”, I would like to be able to get the value “Info4” and place it into a string.
I have the text from the text file stored in a string already, so I just need to manipulate the string so that I can get the information that I want.
Sorry if I explained this in a bad way. Thanks!
I’d use an IDictionary instead.
When reading from your file put the left part (before “-“) as the Dictionary Key and the right part as the Value.
Then you can just get the value by the key:
dictionary[“Info3”] will return “Info4”.
Let me know if you need some actual code…
EDIT: Adding code