我正在做一个项目,我需要在一段文本中搜索特定字符串。但是,我不需要完全匹配,更多的是 % 匹配。
例如,这是我正在搜索的文本段落:
Fluticasone Propionate Nasal Spray, USP 50 mcg per spray is a
corticosteroid indicated for the management of the nasal symptoms of
perennial nonallergic rhinitis in adult and pediatric patients aged 4 years
and older."
然后我正在搜索以下行中的任何单词是否与该段落匹配:
1)Unspecified acute lower respiratory infection
2)Vasomotor rhinitis
3)Allergic rhinitis due to pollen
4)Other seasonal allergic rhinitis
5)Allergic rhinitis due to food
6)Allergic rhinitis due to animal (cat) (dog) hair and dander
7)Other allergic rhinitis
8)"Allergic rhinitis, unspecified"
9)Chronic rhinitis
10)Chronic nasopharyngitis
我最初的方法是使用布尔值并包含:
boolean found = med[x].toLowerCase().contains(condition[y].toLowerCase());
但是,每次循环的结果都是负面的。
我期望的结果是:
1) False
2) True
3) True
4) True
5) True
6) True
7) True
8) True
9) True
10) False
Java 及其方法非常新。基本上,如果 A 中的任何单词与 B 中的任何单词匹配,则将其标记为 true。我怎么做?
谢谢!
茅侃侃
隔江千里
人到中年有点甜
潇湘沐
随时随地看视频慕课网APP
相关分类