petar-dambovaliev / aho-corasick

efficient string matching in Golang via the aho-corasick algorithm.
MIT License
68 stars 11 forks source link

Provide methods that accept `[]byte`. #6

Closed jeschkies closed 3 years ago

jeschkies commented 3 years ago

Hi,

I really like the implementation but would love to have a FindAll(haystack []byte) and also a Build(patterns [][]byte). I saw that all patterns and haystacks are converted to []byte internally. What do you think about accepting []byte by default and have the string methods call these? E.g. FindAllByte(haystack []byte) and then FindAll(haystack string) { FindAllByte([]byte(haystack)) }.

petar-dambovaliev commented 3 years ago

Hey @jeschkies, thanks for the suggestion. It does make sense. I am open to contributions. Would you like to make the API nicer?

jeschkies commented 3 years ago

Sure. That was quick :slightly_smiling_face: