fuzz-walker/vendor/github.com/urfave/cli/sort.go
Vincent Batts 790ac3077a
*: proper cli and vendoring
using `github.com/LK4D4/vndr`

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-06-05 16:53:08 -04:00

29 lines
520 B
Go

package cli
import "unicode"
// lexicographicLess compares strings alphabetically considering case.
func lexicographicLess(i, j string) bool {
iRunes := []rune(i)
jRunes := []rune(j)
lenShared := len(iRunes)
if lenShared > len(jRunes) {
lenShared = len(jRunes)
}
for index := 0; index < lenShared; index++ {
ir := iRunes[index]
jr := jRunes[index]
if lir, ljr := unicode.ToLower(ir), unicode.ToLower(jr); lir != ljr {
return lir < ljr
}
if ir != jr {
return ir < jr
}
}
return i < j
}