MCPcopy
hub / github.com/urfave/cli / lexicographicLess

Function lexicographicLess

sort.go:6–29  ·  sort.go::lexicographicLess

lexicographicLess compares strings alphabetically considering case.

(i, j string)

Source from the content-addressed store, hash-verified

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}

Callers 3

LessMethod · 0.85
TestLexicographicLessFunction · 0.85
LessMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestLexicographicLessFunction · 0.68