如果我有一系列具有此基礎格式字符串:解析在C#中嵌套的文本
"[id value]"//id and value are space delimited. id will never have spaces
然後,他們可以被嵌套這樣的:
[a]
[a [b value]]
[a [b [c [value]]]
所以每個項目可以有0個或1個值條目。
解析這種格式的最佳方法是什麼?我只是使用像string.Split()或string.IndexOf()或有更好的方法?
可以是ID或值包含'['或']'? – 2010-10-12 07:31:11
您是在代碼中創建這個字符串還是來自其他地方? – TalentTuner 2010-10-12 07:33:13
'[a值[b [c值] [d值]]]是否有效? – 2010-10-12 09:03:04