Skip to content

Commit

Permalink
fix: inArray is case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jun 18, 2023
1 parent 126f34e commit e42515a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func max(x, y int) int {

func inArray(haystack []string, needle string) bool {
for _, word := range haystack {
if needle == word {
if strings.EqualFold(needle, word) {
return true
}
}
Expand Down Expand Up @@ -55,6 +55,7 @@ func New() *Replacer {
}

// RemoveRule deletes existing rules.
// The content of `ignore` is case-insensitive.
// TODO: make in place to save memory.
func (r *Replacer) RemoveRule(ignore []string) {
newWords := make([]string, 0, len(r.Replacements))
Expand Down

0 comments on commit e42515a

Please sign in to comment.