github.com/gogf/gf/v2@v2.7.4/text/gstr/gstr_compare.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 package gstr 8 9 import "strings" 10 11 // Compare returns an integer comparing two strings lexicographically. 12 // The result will be 0 if a==b, -1 if a < b, and +1 if a > b. 13 func Compare(a, b string) int { 14 return strings.Compare(a, b) 15 } 16 17 // Equal reports whether `a` and `b`, interpreted as UTF-8 strings, 18 // are equal under Unicode case-folding, case-insensitively. 19 func Equal(a, b string) bool { 20 return strings.EqualFold(a, b) 21 }