Object SpeedSearchMatcher.Companion
-
- All Implemented Interfaces:
public class SpeedSearchMatcher.Companion
-
-
Field Summary
Fields Modifier and Type Field Description public final static SpeedSearchMatcher.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final SpeedSearchMatcherexactSubstringMatcher(String pattern, Boolean ignoreCase)Returns a SpeedSearchMatcher that searches for the given pattern in the text. final SpeedSearchMatcherpatternMatcher(String pattern, Boolean matchFromBeginning, MatchingCaseSensitivity caseSensitivity, String ignoredSeparators)Returns a SpeedSearchMatcher that searches for the given pattern in the text. -
-
Method Detail
-
exactSubstringMatcher
final SpeedSearchMatcher exactSubstringMatcher(String pattern, Boolean ignoreCase)
Returns a SpeedSearchMatcher that searches for the given pattern in the text.
Notes:
This method only matches if the pattern is a substring of the text.
This method returns only the first occurrence of the pattern.
Examples:
val matcher = SpeedSearchMatcher.exactSubstringMatcher("foo") matcher.matches("foobar") // [0..3] matcher.matches("foboar") // null val matcher = SpeedSearchMatcher.exactSubstringMatcher("eye") val result = matcher.matches("an eye for an eye") // [3..6]If you need a more flexible way to match text, use patternMatcher.
- Parameters:
pattern- The string to search for.ignoreCase- Whether to ignore the case of the pattern.
-
patternMatcher
final SpeedSearchMatcher patternMatcher(String pattern, Boolean matchFromBeginning, MatchingCaseSensitivity caseSensitivity, String ignoredSeparators)
Returns a SpeedSearchMatcher that searches for the given pattern in the text. This pattern can match multiple parts of the string submitted in the SpeedSearchMatcher.matches function, not needing the whole string to match as one substring.
Examples:
val matcher = SpeedSearchMatcher.patternMatcher("foo") matcher.matches("foobar") // [0..3] matcher.matches("foboar") // [0..2, 3..4] val matcher = SpeedSearchMatcher.patternMatcher("eye") val result = matcher.matches("an eye for an eye") // [3..6]- Parameters:
pattern- The pattern to search for.matchFromBeginning- Whether to match the pattern must start from the beginning of the string.caseSensitivity- The case sensitivity handling during a pattern match.ignoredSeparators- A string containing characters that should not be considered separators.
-
-
-
-