Back to Lo

Core Issortedby

docs/data/core-issortedby.md

1.53.0178 B
Original Source

Checks if a slice is sorted based on a key computed for each element.

go
ok := lo.IsSortedBy([]string{"a", "bb", "ccc"}, func(s string) int {
    return len(s)
})
// true