0
我正在尋找最有效的方式來接受字符串和令牌,將它蛻化爲一個數組,將所有HTML標記組分隔開來。Tokenize或將字符串拆分爲文本和Html標記項
Example Input (String):
"I can format my text so that <strong>This is bold</strong> and this is not."
Desired Output (String[] array):
"I can format my text so that",
"<strong>",
"This is bold",
"</strong>",
"and this is not."
Alternate Output Just As Good(String[] array):
"I",
"can",
"format",
"my",
"text",
"so",
"that",
"<strong>",
"This",
"is",
"bold",
"</strong>",
"and",
"this",
"is",
"not."
我不確定如何解決此問題的最佳方法。任何幫助,將不勝感激。
'Regex.Split(inputString, 「(<=>)|(= <)?」);' –
使用正則表達式' .Split(s,@「(<[^<]*?>)」)' –