鉴于html文件的这一部分,我正在寻找一种方法从“Metronidazole ......”开始提取文本到“指示和使用”下的结尾。
有什么建议吗?
<div class="Section" data-sectionCode="34067-9">
<a name="section-4"></a>
<p></p>
<h1>
<span class="Bold">INDICATIONS & USAGE
</span>
</h1>
<p class="First">Metronidazole vaginal gel USP, 0.75% is indicated in the treatment of bacterial vaginosis (formerly referred to as <span class="Italics">Haemophilus</span> vaginitis, <span class="Italics">Gardnerella</span> vaginitis, nonspecific vaginitis, <span class="Italics">Corynebacterium</span> vaginitis, or anaerobic vaginosis).</p>
<dl>
<dt></dt>
<dd>
<p class="First">
<span class="Bold">NOTE:</span> For purposes of this indication, a clinical diagnosis of bacterial vaginosis is usually defined by the presence of a homogeneous vaginal discharge that (a) has a pH of greater than 4.5, (b) emits a “fishy” amine odor when mixed with a 10% KOH solution, and (c) contains clue cells on microscopic examination. Gram’s stain results consistent with a diagnosis of bacterial vaginosis include (a) markedly reduced or absent <span class="Italics">Lactobacillus</span> morphology, (b) predominance of <span class="Italics">Gardnerella</span> morphotype, and (c) absent or few white blood cells.</p>
</dd>
</dl>
<p>Other pathogens commonly associated with vulvovaginitis, e.g., <span class="Italics">Trichomonas vaginalis</span>, <span class="Italics">Chlamydia trachomatis</span>, <span class="Italics">N</span>. <span class="Italics">gonorrhoeae</span>, <span class="Italics">Candida albicans</span>, and <span class="Italics">Herpes simplex</span> virus should be ruled out.</p>
</div>
应排除通常与外阴阴道炎相关的其他病原体,例如阴道毛滴虫,沙眼衣原体,淋病奈瑟菌,白色念珠菌和单纯疱疹病毒。
答案 0 :(得分:0)
你可以使用一些旧的学校技巧,
或者您可以使用其他特技
NSString* startTag = @"<";
NSString* endTag = @">";
NSString* replacementString = @"";
while ([str rangeOfString:startTag].length != 0 && [str rangeOfString:endTag].length != 0)
{
NSRange range1 = [str rangeOfString:startTag];
NSRange range2 = [str rangeOfString:endTag];
if(range1.location>range2.location)
break;
NSRange newRange;
newRange.length =range2.location-range1.location+range2.length;
newRange.location = range1.location;
str = [str stringByReplacingCharactersInRange:newRange withString:replacementString];
}
然后您可以按照&#34;指示&amp;中所述找到文本。 USAGE&#34;通过rangeOfString方法,您希望的文本应该在此范围之后。