我有一個包含一些不需要的字符的字符串,所以我想刪除這些字符。我從XML文件中讀取不需要的字符。如何從字符串中刪除 t char
"<UnwantedChars>\t,@</UnwantedChars>"
sUnwantedChar = xml.ReadNodeValue("\UnwantedChars")
我試圖
str = str.Replace(sUnwantedChar.Split(',')[0],string.Empty)
str = str.Replace(sUnwantedChar.Split(',')[1],string.Empty)
在最終結果,@
被刪除,但選項卡即\t
不會被刪除。
你的xml的結構是什麼? – 2015-02-10 08:03:09
您是否檢查過''UnwantedChar'包含的內容? – Sayse 2015-02-10 08:04:15
「 \ t,@ UnwantedChars>」 –
2015-02-10 08:05:22