/** * 檢測 originText 是否包含 includeText * @param originText 要檢測的字符串 * @param includeText 是否包含該字符串 * @return true,即包包含,false則不包含 */ public boolean checkCarrier(String originText,String includeText){ Pattern pattern = Pattern.compile(includeText,Pattern.CASE_INSENSITIVE); // 不區分大小寫 Matcher matcher = pattern.matcher(originText); boolean result = matcher.find(); return result; }