Skip to content

Commit

Permalink
✨ v3 (enhancement): add []byte support to utils.EqualFold (#2029)
Browse files Browse the repository at this point in the history
* EqualFold

* add comment
  • Loading branch information
trim21 authored Aug 19, 2022
1 parent 4105b00 commit 73d0b71
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ func TrimRight(s string, cutset byte) string {
return s[:lenStr]
}

// EqualFold tests ascii strings for equality case-insensitively
func EqualFold(b, s string) bool {
type byteSeq interface {
~string | ~[]byte
}

// EqualFold tests ascii strings or bytes for equality case-insensitively
func EqualFold[S byteSeq](b, s S) bool {
if len(b) != len(s) {
return false
}
Expand Down

0 comments on commit 73d0b71

Please sign in to comment.