How to determine if one string contains words from another string
我想检查字符串是否包含C中任意顺序的单词。我怎样才能用一个简单的if语句来实现这一点呢?见下例:
1 2 3 4 5 6 7 8 9 | string a ="PT. DOWELL ANADRILL SCHLUMBERGER"; string b ="ANADRILL DOWELL"; if( a.Contains( b ) ) { MessageBox.Show("true"); } else { // the if always evaluates to false MessageBox.Show("false"); } |
(P)如果你想知道,如果EDOCX1的英文字母是0,里面有任何单词在EDOCX1中。(p)字母名称(P)或者如果你想写的话,就用英文写所有单词。(p)字母名称(P)Note neither make sure the words in EDOCX1 universal 1 are not subwords in EDOCX1.(p)字母名称(P)Also this only splits the words in EDOCX1 penography 1 on white espace,so it would uldn't work if there is puctation you want to ignore like(p)字母名称
(P)这是另一种方式,如果你知道有一个空间在几句话到检查。(p)字母名称
字母名称(P)注(p)