MCPcopy Index your code
hub / github.com/cloudfoundry/cli / LessIgnoreCase

Function LessIgnoreCase

util/sorting/alphabetic.go:10–34  ·  view source on GitHub ↗

LessIgnoreCase returns true if first is alphabetically less than second.

(first string, second string)

Source from the content-addressed store, hash-verified

8
9// LessIgnoreCase returns true if first is alphabetically less than second.
10func LessIgnoreCase(first string, second string) bool {
11 iRunes := []rune(first)
12 jRunes := []rune(second)
13
14 max := len(iRunes)
15 if max > len(jRunes) {
16 max = len(jRunes)
17 }
18
19 for idx := 0; idx < max; idx++ {
20 ir := iRunes[idx]
21 jr := jRunes[idx]
22
23 lir := unicode.ToLower(ir)
24 ljr := unicode.ToLower(jr)
25
26 if lir == ljr {
27 continue
28 }
29
30 return lir < ljr
31 }
32
33 return false
34}
35
36// SortAlphabeticFunc returns a `less()` comparator for sorting strings while
37// respecting case.

Callers 4

ExecuteMethod · 0.92
ExecuteMethod · 0.92
GetRouteSummariesMethod · 0.92
SortAlphabeticFuncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected