MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / LocaleNamesAreEqual

Function LocaleNamesAreEqual

pkg/sql/lex/encode.go:66–89  ·  view source on GitHub ↗

LocaleNamesAreEqual checks for equality of two locale names. The comparison is case-insensitive and treats '-' and '_' as the same.

(a, b string)

Source from the content-addressed store, hash-verified

64// LocaleNamesAreEqual checks for equality of two locale names. The comparison
65// is case-insensitive and treats '-' and '_' as the same.
66func LocaleNamesAreEqual(a, b string) bool {
67 if a == b {
68 return true
69 }
70 if len(a) != len(b) {
71 return false
72 }
73 for i, n := 0, len(a); i < n; i++ {
74 ai, bi := a[i], b[i]
75 if ai == bi {
76 continue
77 }
78 if ai == '-' && bi == '_' {
79 continue
80 }
81 if ai == '_' && bi == '-' {
82 continue
83 }
84 if unicode.ToLower(rune(ai)) != unicode.ToLower(rune(bi)) {
85 return false
86 }
87 }
88 return true
89}
90
91// EncodeByteArrayToRawBytes converts a SQL-level byte array into raw
92// bytes according to the encoding specification in "be".

Callers 3

EquivalentMethod · 0.92
IdenticalMethod · 0.92
CompareMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…