Commit 78e5288b authored by Andrew Medvedev's avatar Andrew Medvedev Committed by Rob Pike

strings, bytes: clarify usage of EqualFolds

This clarifies meaning of "case folding" Unicode equality with more familiar "case insensitive" wording.
For case folding properties see ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt.

Fixes #33447

Change-Id: I6ee85ab398679bf2a0b7d18693985ff0979d6c5a
GitHub-Last-Rev: accc9159330c61e046d77f77beac62b38bf72c19
GitHub-Pull-Request: golang/go#34434
Reviewed-on: https://go-review.googlesource.com/c/go/+/196717Reviewed-by: default avatarRob Pike <r@golang.org>
parent 9c0e56bf
...@@ -935,7 +935,8 @@ func ReplaceAll(s, old, new []byte) []byte { ...@@ -935,7 +935,8 @@ func ReplaceAll(s, old, new []byte) []byte {
} }
// EqualFold reports whether s and t, interpreted as UTF-8 strings, // EqualFold reports whether s and t, interpreted as UTF-8 strings,
// are equal under Unicode case-folding. // are equal under Unicode case-folding, which is a more general
// form of case-insensitivity.
func EqualFold(s, t []byte) bool { func EqualFold(s, t []byte) bool {
for len(s) != 0 && len(t) != 0 { for len(s) != 0 && len(t) != 0 {
// Extract first rune from each. // Extract first rune from each.
......
...@@ -969,7 +969,8 @@ func ReplaceAll(s, old, new string) string { ...@@ -969,7 +969,8 @@ func ReplaceAll(s, old, new string) string {
} }
// EqualFold reports whether s and t, interpreted as UTF-8 strings, // EqualFold reports whether s and t, interpreted as UTF-8 strings,
// are equal under Unicode case-folding. // are equal under Unicode case-folding, which is a more general
// form of case-insensitivity.
func EqualFold(s, t string) bool { func EqualFold(s, t string) bool {
for s != "" && t != "" { for s != "" && t != "" {
// Extract first rune from each string. // Extract first rune from each string.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment