Skip to content

Commit

Permalink
slices: use strings.EqualFold in ExampleCompactFunc
Browse files Browse the repository at this point in the history
Change-Id: Ie7d495b2a53520ce89b16bc8a66b81a3955bf32f
Reviewed-on: https://go-review.googlesource.com/c/go/+/530635
Reviewed-by: Eli Bendersky <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
ianlancetaylor authored and gopherbot committed Sep 22, 2023
1 parent 9f8f1ca commit bcfaf2f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/slices/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ func ExampleCompact() {

func ExampleCompactFunc() {
names := []string{"bob", "Bob", "alice", "Vera", "VERA"}
names = slices.CompactFunc(names, func(a, b string) bool {
return strings.ToLower(a) == strings.ToLower(b)
})
names = slices.CompactFunc(names, strings.EqualFold)
fmt.Println(names)
// Output:
// [bob alice Vera]
Expand Down

0 comments on commit bcfaf2f

Please sign in to comment.