Source File
internal.go
Belonging Package
golang.org/x/text/internal
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package internal contains non-exported functionality that are used by
// packages in the text repository.
package internal // import "golang.org/x/text/internal"
import (
)
// SortTags sorts tags in place.
func ( []language.Tag) {
sort.Sort(sorter())
}
type sorter []language.Tag
func ( sorter) () int {
return len()
}
func ( sorter) (, int) {
[], [] = [], []
}
func ( sorter) (, int) bool {
return [].String() < [].String()
}
// UniqueTags sorts and filters duplicate tags in place and returns a slice with
// only unique tags.
func ( []language.Tag) []language.Tag {
if len() <= 1 {
return
}
SortTags()
:= 0
for := 1; < len(); ++ {
if [].String() < [].String() {
++
[] = []
}
}
return [:+1]
}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |