github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/text/cldr/examples_test.go (about)

     1  package cldr_test
     2  
     3  import (
     4  	"fmt"
     5  	"golang.org/x/text/cldr"
     6  )
     7  
     8  func ExampleSlice() {
     9  	var dr *cldr.CLDR // assume this is initalized
    10  
    11  	x, _ := dr.LDML("en")
    12  	cs := x.Collations.Collation
    13  	// remove all but the default
    14  	cldr.MakeSlice(&cs).Filter(func(e cldr.Elem) bool {
    15  		return e.GetCommon().Type != x.Collations.Default()
    16  	})
    17  	for i, c := range cs {
    18  		fmt.Println(i, c.Type)
    19  	}
    20  }