LocaleNamesAreEqual checks for equality of two locale names. The comparison is case-insensitive and treats '-' and '_' as the same.
(a, b string)
| 64 | // LocaleNamesAreEqual checks for equality of two locale names. The comparison |
| 65 | // is case-insensitive and treats '-' and '_' as the same. |
| 66 | func 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". |
no outgoing calls
no test coverage detected
searching dependent graphs…