Skip to content

callmekatootie/strsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strsearch

Use Boyer Moore Horspool algorithm to search for a pattern in a text

Golang already has a Contains method on the strings package. However, that uses the Rabin-Karp algorithm.
This library uses the Boyer Moore Horspool algorithm.

To use this library, import as:

import "github.com/callmekatootie/strsearch"

Examples

strsearch.Find(<text>, <pattern>)
strsearch.Find("Hello World!", "orl") // 7

Returns the position of the pattern in the text - position is 0 based

strsearch.Find("What sorcery is this?", "nothing") // -1

Returns -1 if the pattern can't be found in the text

License

MIT

About

Use Boyer Moore Horspool algorithm to search for a pattern in a text

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages