Timeline for What is the best way to parse this string in C#?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 31, 2011 at 11:25 | comment | added | Johann du Toit | Well it's possible. You could probably then just scan the string and search for the location of the {key}: and then substring it from that location to the next : and then check for any key that is still in the string and replace it. But this seems very "Ugly". Can't you change the Input Format ? Or is it a third party lib? | |
May 31, 2011 at 11:21 | comment | added | ZombieSheep | Ah, I missed that bit of the original question. That being the case, you're right and the OP is likely to have to resort to best guesses... Maybe if the keys are from a predefined list of possibilities? | |
May 31, 2011 at 11:16 | history | edited | Johann du Toit | CC BY-SA 3.0 |
added 191 characters in body
|
May 31, 2011 at 11:13 | comment | added | Jon Grant | The question says there can be spaces in the key AND the value... even regexes can't solve that problem. | |
May 31, 2011 at 11:08 | comment | added | Johann du Toit | That's why I use it. Not that I can but because I have too. :D | |
May 31, 2011 at 11:07 | comment | added | ZombieSheep | As much as I hate Regex, I think it is the way to go in this instance. | |
May 31, 2011 at 11:05 | history | answered | Johann du Toit | CC BY-SA 3.0 |