我有一个字符串是-
<span style=\"font-weight: 800\">Residence, Effective Date: NA</span> <br />6367 US HIGHWAY 70 EAST<br />LA GRANGE NC 28551 <br />
我想先出现字符串的第一部分,然后<br />
选择的部分应该像这样:
<span style=\"font-weight: 800\">Residence, Effective Date: NA</span>
目前我在做-
string dictVal = "<span style=\"font-weight: 800\">Residence, Effective Date: NA</span> <br />6367 US HIGHWAY 70 EAST<br />LA GRANGE NC 28551 <br />";
string[] items = dictVal.Split(new char[] { '<' },
StringSplitOptions.RemoveEmptyEntries);
string firstPart = string.Join("<", items.Take(3));
但它不起作用。
只需使用string.Substring
和string.IndexOf
:
string firstPart = dictVal.Substring(0, dictVal.IndexOf("<br />"))
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句