StringSearchExtensions extension

Convenience extensions for using StringSearch on String instances.

Note: We intentionally avoid names like indexOf / contains to prevent confusion with built-in String methods.

on

Methods

containsPattern(String pattern, {SearchAlgorithm algorithm = SearchAlgorithm.boyerMoore, int start = 0}) bool

Available on String, provided by the StringSearchExtensions extension

Returns true if pattern occurs in this string using the chosen algorithm.
findAllMatches(String pattern, {SearchAlgorithm algorithm = SearchAlgorithm.boyerMoore}) List<SearchMatch>

Available on String, provided by the StringSearchExtensions extension

Returns all matches (including overlapping matches).
findAllMatchIndices(String pattern, {SearchAlgorithm algorithm = SearchAlgorithm.boyerMoore}) List<int>

Available on String, provided by the StringSearchExtensions extension

Returns all match indices (including overlapping matches).
indexOfPattern(String pattern, {SearchAlgorithm algorithm = SearchAlgorithm.boyerMoore, int start = 0}) int

Available on String, provided by the StringSearchExtensions extension

Finds the first index of pattern in this string using the chosen algorithm.