1package cli 2 3import "unicode" 4 5// lexicographicLess compares strings alphabetically considering case. 6func lexicographicLess(i, j string) bool { 7 iRunes := []rune(i) 8 jRunes := []rune(j) 9 10 lenShared := len(iRunes) 11 if lenShared > len(jRunes) { 12 lenShared = len(jRunes) 13 } 14 15 for index := 0; index < lenShared; index++ { 16 ir := iRunes[index] 17 jr := jRunes[index] 18 19 if lir, ljr := unicode.ToLower(ir), unicode.ToLower(jr); lir != ljr { 20 return lir < ljr 21 } 22 23 if ir != jr { 24 return ir < jr 25 } 26 } 27 28 return i < j 29} 30