【发布时间】:2013-09-14 09:00:50
【问题描述】:
我需要在 C# 中替换文本,同时忽略任何空格。
例如:
"This is a text with some tags <UL> <P> <LI>",
"This is a text with some tags <UL> <P> <LI>",
"This is a text with some tags <UL><P> <LI>" or
"This is a text with some tags <UL><P><LI>"
必须全部替换为
"This is a text with some tags <UL><LI>"
请注意,我不能从整个字符串中删除空格然后替换所需的字符串,因为这会给出错误的结果 -
"Thisisatextwithsometags<UL><LI>"
我确定这3个标签
"<UL>", "<P>" and "<LI>"
将按该顺序出现,但不确定它们之间的空格。
【问题讨论】: