mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Split IDE into 2 projects.
BEWARE: HIGHLY EXPERIMENTAL BRANCH
This commit is contained in:
29
arduino-core/src/processing/app/helpers/StringUtils.java
Normal file
29
arduino-core/src/processing/app/helpers/StringUtils.java
Normal file
@ -0,0 +1,29 @@
|
||||
package processing.app.helpers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class StringUtils {
|
||||
|
||||
public static boolean stringContainsOneOf(String input, List<String> listOfStrings) {
|
||||
for (String string : listOfStrings) {
|
||||
if (input.contains(string)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to match <b>input</b> with <b>pattern</b>. The pattern can use the
|
||||
* "*" and "?" globs to match any-char-sequence and any-char respectively.
|
||||
*
|
||||
* @param input The string to be checked
|
||||
* @param pattern The pattern to match
|
||||
* @return <b>true</b> if the <b>input</b> matches the <b>pattern</b>,
|
||||
* <b>false</b> otherwise.
|
||||
*/
|
||||
public static boolean wildcardMatch(String input, String pattern) {
|
||||
String regex = pattern.replace("?", ".?").replace("*", ".*?");
|
||||
return input.matches(regex);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user