我有一個輸入字符串,其中包含一對搜索項以在包括所有搜索項的文本中查找一行。if語句中的動態和條件
例如:
String searchTerms = "java stackoverflow conditions";
String [] splittedTerm = searchTerms.split(" ");
的搜尋字詞和結締組織:
if (textLine.contains(splittedTerm[0] && textLine.contains(splittedTerm[1]) && textLine.contains(splittedTerm[2])) start=true;
但搜索詞的數量是動態的,它ALWAYSE取決於用戶的請求......
因此,根據搜索條件的數量,是否有可能使用if語句?
怎麼樣a,b,c ......他們來自哪裏? –
字符串相等性未用'=='測試。聽起來像你想要一個循環。 –
@ElliottFrisch似乎模擬代碼。 –