package cases
Import Path
golang.org/x/text/cases (on go.dev)
Dependency Relation
imports 7 packages, and imported by one package
Involved Source Files
Package cases provides general and language-specific case mappers.
context.go
fold.go
info.go
map.go
tables15.0.0.go
trieval.go
Code Examples
package main
import (
"fmt"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)
func main() {
src := []string{
"hello world!",
"i with dot",
"'n ijsberg",
"here comes O'Brian",
}
for _, c := range []cases.Caser{
cases.Lower(language.Und),
cases.Upper(language.Turkish),
cases.Title(language.Dutch),
cases.Title(language.Und, cases.NoLower),
} {
fmt.Println()
for _, s := range src {
fmt.Println(c.String(s))
}
}
}
Package-Level Type Names (total 2)
A Caser transforms given input to a certain case. It implements
transform.Transformer.
A Caser may be stateful and should therefore not be shared between
goroutines.
Bytes returns a new byte slice with the result of converting b to the case
form implemented by c.
Reset resets the Caser to be reused for new input after a previous call to
Transform.
Span implements the transform.SpanningTransformer interface.
String returns a string with the result of transforming s to the case form
implemented by c.
Transform implements the transform.Transformer interface and transforms the
given input to the case form implemented by c.
Caser : golang.org/x/text/transform.SpanningTransformer
Caser : golang.org/x/text/transform.Transformer
Caser : vendor/golang.org/x/text/transform.SpanningTransformer
Caser : vendor/golang.org/x/text/transform.Transformer
func Fold(opts ...Option) Caser
func Lower(t language.Tag, opts ...Option) Caser
func Title(t language.Tag, opts ...Option) Caser
func Upper(t language.Tag, opts ...Option) Caser
An Option is used to modify the behavior of a Caser.
func HandleFinalSigma(enable bool) Option
func Fold(opts ...Option) Caser
func Lower(t language.Tag, opts ...Option) Caser
func Title(t language.Tag, opts ...Option) Caser
func Upper(t language.Tag, opts ...Option) Caser
func golang.org/x/text/secure/precis.FoldCase(opts ...Option) precis.Option
func golang.org/x/text/secure/precis.LowerCase(opts ...Option) precis.Option
var Compact
var NoLower
Package-Level Functions (total 5)
Fold returns a Caser that implements Unicode case folding. The returned Caser
is stateless and safe to use concurrently by multiple goroutines.
Case folding does not normalize the input and may not preserve a normal form.
Use the collate or search package for more convenient and linguistically
sound comparisons. Use golang.org/x/text/secure/precis for string comparisons
where security aspects are a concern.
HandleFinalSigma specifies whether the special handling of Greek final sigma
should be enabled. Unicode prescribes handling the Greek final sigma for all
locales, but standards like IDNA and PRECIS override this default.
Lower returns a Caser for language-specific lowercasing.
Title returns a Caser for language-specific title casing. It uses an
approximation of the default Unicode Word Break algorithm.
Upper returns a Caser for language-specific uppercasing.
Package-Level Variables (total 3)
Compact omits mappings in case folding for characters that would grow the
input. (Unimplemented.)
NoLower disables the lowercasing of non-leading letters for a title
caser.
Package-Level Constants (only one)
UnicodeVersion is the Unicode version from which the tables in this package are derived.
![]() |
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. |