Back to godoc.org
golang.org/x/text/internal/tag

package tag

v0.3.2
Latest Go to latest
Published: Apr 25, 2019 | License: BSD-3-Clause | Module: golang.org/x/text

Overview

Package tag contains functionality handling tags and related data.

Index

func Compare

func Compare(a string, b []byte) int

Compare returns an integer comparing a and b lexicographically.

func FixCase

func FixCase(form string, b []byte) bool

FixCase reformats b to the same pattern of cases as form. If returns false if string b is malformed.

type Index

type Index string

An Index converts tags to a compact numeric value.

All elements are of size 4. Tags may be up to 4 bytes long. Excess bytes can be used to store additional information about the tag.

func (Index) Elem

func (s Index) Elem(x int) string

Elem returns the element data at the given index.

func (Index) Index

func (s Index) Index(key []byte) int

Index reports the index of the given key or -1 if it could not be found. Only the first len(key) bytes from the start of the 4-byte entries will be considered for the search and the first match in Index will be returned.

func (Index) Next

func (s Index) Next(key []byte, x int) int

Next finds the next occurrence of key after index x, which must have been obtained from a call to Index using the same key. It returns x+1 or -1.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier