cases

Imports

Imports #

"golang.org/x/text/language"
"golang.org/x/text/transform"
"golang.org/x/text/transform"
"C"
"unsafe"
"golang.org/x/text/transform"
"strings"
"unicode"
"unicode/utf8"
"golang.org/x/text/internal"
"golang.org/x/text/language"
"golang.org/x/text/transform"
"golang.org/x/text/unicode/norm"

Constants & Variables

Compact var #

Compact omits mappings in case folding for characters that would grow the input. (Unimplemented.)

var Compact Option = compact

NoLower var #

NoLower disables the lowercasing of non-leading letters for a title caser.

var NoLower Option = noLower

Supported var #

var Supported language.Coverage

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "15.0.0"

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "9.0.0"

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "10.0.0"

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "12.0.0"

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "11.0.0"

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "13.0.0"

above const #

const above = 230

cIgnorableCased const #

The case mode bits encodes the case type of a rune. This includes uncased, title, upper and lower case and case ignorable. (For a definition of these terms see Chapter 3 of The Unicode Standard Core Specification.) In some rare cases, a rune can be both cased and case-ignorable. This is encoded by cIgnorableCased. A rune of this type is always lower case. Some runes are cased while not having a mapping. A common pattern for scripts in the Unicode standard is for upper and lower case runes to alternate for increasing rune values (e.g. the accented Latin ranges starting from U+0100 and U+1E00 among others and some Cyrillic characters). We use this property by defining a cXORCase mode, where the case mode (always upper or lower case) is derived from the rune value. As the XOR pattern for case mappings is often identical for successive runes, using cXORCase can result in large series of identical trie values. This, in turn, allows us to better compress the trie blocks.

const cIgnorableCased

cIgnorableUncased const #

The case mode bits encodes the case type of a rune. This includes uncased, title, upper and lower case and case ignorable. (For a definition of these terms see Chapter 3 of The Unicode Standard Core Specification.) In some rare cases, a rune can be both cased and case-ignorable. This is encoded by cIgnorableCased. A rune of this type is always lower case. Some runes are cased while not having a mapping. A common pattern for scripts in the Unicode standard is for upper and lower case runes to alternate for increasing rune values (e.g. the accented Latin ranges starting from U+0100 and U+1E00 among others and some Cyrillic characters). We use this property by defining a cXORCase mode, where the case mode (always upper or lower case) is derived from the rune value. As the XOR pattern for case mappings is often identical for successive runes, using cXORCase can result in large series of identical trie values. This, in turn, allows us to better compress the trie blocks.

const cIgnorableUncased

cLower const #

The case mode bits encodes the case type of a rune. This includes uncased, title, upper and lower case and case ignorable. (For a definition of these terms see Chapter 3 of The Unicode Standard Core Specification.) In some rare cases, a rune can be both cased and case-ignorable. This is encoded by cIgnorableCased. A rune of this type is always lower case. Some runes are cased while not having a mapping. A common pattern for scripts in the Unicode standard is for upper and lower case runes to alternate for increasing rune values (e.g. the accented Latin ranges starting from U+0100 and U+1E00 among others and some Cyrillic characters). We use this property by defining a cXORCase mode, where the case mode (always upper or lower case) is derived from the rune value. As the XOR pattern for case mappings is often identical for successive runes, using cXORCase can result in large series of identical trie values. This, in turn, allows us to better compress the trie blocks.

const cLower

cTitle const #

The case mode bits encodes the case type of a rune. This includes uncased, title, upper and lower case and case ignorable. (For a definition of these terms see Chapter 3 of The Unicode Standard Core Specification.) In some rare cases, a rune can be both cased and case-ignorable. This is encoded by cIgnorableCased. A rune of this type is always lower case. Some runes are cased while not having a mapping. A common pattern for scripts in the Unicode standard is for upper and lower case runes to alternate for increasing rune values (e.g. the accented Latin ranges starting from U+0100 and U+1E00 among others and some Cyrillic characters). We use this property by defining a cXORCase mode, where the case mode (always upper or lower case) is derived from the rune value. As the XOR pattern for case mappings is often identical for successive runes, using cXORCase can result in large series of identical trie values. This, in turn, allows us to better compress the trie blocks.

const cTitle

cUncased const #

The case mode bits encodes the case type of a rune. This includes uncased, title, upper and lower case and case ignorable. (For a definition of these terms see Chapter 3 of The Unicode Standard Core Specification.) In some rare cases, a rune can be both cased and case-ignorable. This is encoded by cIgnorableCased. A rune of this type is always lower case. Some runes are cased while not having a mapping. A common pattern for scripts in the Unicode standard is for upper and lower case runes to alternate for increasing rune values (e.g. the accented Latin ranges starting from U+0100 and U+1E00 among others and some Cyrillic characters). We use this property by defining a cXORCase mode, where the case mode (always upper or lower case) is derived from the rune value. As the XOR pattern for case mappings is often identical for successive runes, using cXORCase can result in large series of identical trie values. This, in turn, allows us to better compress the trie blocks.

const cUncased info = iota

cUpper const #

The case mode bits encodes the case type of a rune. This includes uncased, title, upper and lower case and case ignorable. (For a definition of these terms see Chapter 3 of The Unicode Standard Core Specification.) In some rare cases, a rune can be both cased and case-ignorable. This is encoded by cIgnorableCased. A rune of this type is always lower case. Some runes are cased while not having a mapping. A common pattern for scripts in the Unicode standard is for upper and lower case runes to alternate for increasing rune values (e.g. the accented Latin ranges starting from U+0100 and U+1E00 among others and some Cyrillic characters). We use this property by defining a cXORCase mode, where the case mode (always upper or lower case) is derived from the rune value. As the XOR pattern for case mappings is often identical for successive runes, using cXORCase can result in large series of identical trie values. This, in turn, allows us to better compress the trie blocks.

const cUpper

cXORCase const #

The case mode bits encodes the case type of a rune. This includes uncased, title, upper and lower case and case ignorable. (For a definition of these terms see Chapter 3 of The Unicode Standard Core Specification.) In some rare cases, a rune can be both cased and case-ignorable. This is encoded by cIgnorableCased. A rune of this type is always lower case. Some runes are cased while not having a mapping. A common pattern for scripts in the Unicode standard is for upper and lower case runes to alternate for increasing rune values (e.g. the accented Latin ranges starting from U+0100 and U+1E00 among others and some Cyrillic characters). We use this property by defining a cXORCase mode, where the case mode (always upper or lower case) is derived from the rune value. As the XOR pattern for case mappings is often identical for successive runes, using cXORCase can result in large series of identical trie values. This, in turn, allows us to better compress the trie blocks.

const cXORCase

caseIndex var #

caseIndex: 27 blocks, 1728 entries, 3456 bytes Block 0 is the zero block.

var caseIndex = [1728]uint16{...}

caseIndex var #

caseIndex: 25 blocks, 1600 entries, 3200 bytes Block 0 is the zero block.

var caseIndex = [1600]uint16{...}

caseIndex var #

caseIndex: 25 blocks, 1600 entries, 3200 bytes Block 0 is the zero block.

var caseIndex = [1600]uint16{...}

caseIndex var #

caseIndex: 25 blocks, 1600 entries, 3200 bytes Block 0 is the zero block.

var caseIndex = [1600]uint16{...}

caseIndex var #

caseIndex: 25 blocks, 1600 entries, 3200 bytes Block 0 is the zero block.

var caseIndex = [1600]uint16{...}

caseIndex var #

caseIndex: 25 blocks, 1600 entries, 3200 bytes Block 0 is the zero block.

var caseIndex = [1600]uint16{...}

caseValues var #

caseValues: 22 blocks, 1408 entries, 2816 bytes The third block is the zero block.

var caseValues = [1408]uint16{...}

caseValues var #

caseValues: 22 blocks, 1408 entries, 2816 bytes The third block is the zero block.

var caseValues = [1408]uint16{...}

caseValues var #

caseValues: 20 blocks, 1280 entries, 2560 bytes The third block is the zero block.

var caseValues = [1280]uint16{...}

caseValues var #

caseValues: 22 blocks, 1408 entries, 2816 bytes The third block is the zero block.

var caseValues = [1408]uint16{...}

caseValues var #

caseValues: 24 blocks, 1536 entries, 3072 bytes The third block is the zero block.

var caseValues = [1536]uint16{...}

caseValues var #

caseValues: 20 blocks, 1280 entries, 2560 bytes The third block is the zero block.

var caseValues = [1280]uint16{...}

casedMask const #

const casedMask = 0x0003

cccAbove const #

The case mapping implementation will need to know about various Canonical Combining Class (CCC) values. We encode two of these in the trie value: cccZero (0) and cccAbove (230). If the value is cccOther, it means that CCC(r) > 0, but not 230. A value of cccBreak means that CCC(r) == 0 and that the rune also has the break category Break (see below).

const cccAbove

cccBreak const #

The case mapping implementation will need to know about various Canonical Combining Class (CCC) values. We encode two of these in the trie value: cccZero (0) and cccAbove (230). If the value is cccOther, it means that CCC(r) > 0, but not 230. A value of cccBreak means that CCC(r) == 0 and that the rune also has the break category Break (see below).

const cccBreak info = *ast.BinaryExpr

cccMask const #

The case mapping implementation will need to know about various Canonical Combining Class (CCC) values. We encode two of these in the trie value: cccZero (0) and cccAbove (230). If the value is cccOther, it means that CCC(r) > 0, but not 230. A value of cccBreak means that CCC(r) == 0 and that the rune also has the break category Break (see below).

const cccMask = *ast.BinaryExpr

cccOther const #

The case mapping implementation will need to know about various Canonical Combining Class (CCC) values. We encode two of these in the trie value: cccZero (0) and cccAbove (230). If the value is cccOther, it means that CCC(r) > 0, but not 230. A value of cccBreak means that CCC(r) == 0 and that the rune also has the break category Break (see below).

const cccOther

cccZero const #

The case mapping implementation will need to know about various Canonical Combining Class (CCC) values. We encode two of these in the trie value: cccZero (0) and cccAbove (230). If the value is cccOther, it means that CCC(r) > 0, but not 230. A value of cccBreak means that CCC(r) == 0 and that the rune also has the break category Break (see below).

const cccZero

exceptionBit const #

const exceptionBit = *ast.BinaryExpr

exceptionShift const #

const exceptionShift = 4

exceptions var #

var exceptions string = *ast.BinaryExpr

exceptions var #

var exceptions string = *ast.BinaryExpr

exceptions var #

var exceptions string = *ast.BinaryExpr

exceptions var #

var exceptions string = *ast.BinaryExpr

exceptions var #

var exceptions string = *ast.BinaryExpr

exceptions var #

var exceptions string = *ast.BinaryExpr

fullCasedMask const #

const fullCasedMask = 0x0007

hasMappingMask const #

There is no mapping if all xor bits and the exception bit are zero.

const hasMappingMask = *ast.BinaryExpr

ignorableMask const #

const ignorableMask = 0x0006

ignorableValue const #

const ignorableValue = 0x0004

inverseFoldBit const #

const inverseFoldBit = *ast.BinaryExpr

iotaSubscript const #

const iotaSubscript = 240

isMidBit const #

const isMidBit = *ast.BinaryExpr

lastRuneForTesting const #

lastRuneForTesting is the last rune used for testing. Everything after this is boring.

const lastRuneForTesting = *ast.CallExpr

lengthBits const #

The exceptions slice holds data that does not fit in a normal info entry. The entry is pointed to by the exception index in an entry. It has the following format: Header: byte 0: 7..6 unused 5..4 CCC type (same bits as entry) 3 unused 2..0 length of fold byte 1: 7..6 unused 5..3 length of 1st mapping of case type 2..0 length of 2nd mapping of case type case 1st 2nd lower -> upper, title upper -> lower, title title -> lower, upper Lengths with the value 0x7 indicate no value and implies no change. A length of 0 indicates a mapping to zero-length string. Body bytes: case folding bytes lowercase mapping bytes uppercase mapping bytes titlecase mapping bytes closure mapping bytes (for NFKC_Casefold). (TODO) Fallbacks: missing fold -> lower missing title -> upper all missing -> original rune exceptions starts with a dummy byte to enforce that there is no zero index value.

const lengthBits = 3

lengthMask const #

The exceptions slice holds data that does not fit in a normal info entry. The entry is pointed to by the exception index in an entry. It has the following format: Header: byte 0: 7..6 unused 5..4 CCC type (same bits as entry) 3 unused 2..0 length of fold byte 1: 7..6 unused 5..3 length of 1st mapping of case type 2..0 length of 2nd mapping of case type case 1st 2nd lower -> upper, title upper -> lower, title title -> lower, upper Lengths with the value 0x7 indicate no value and implies no change. A length of 0 indicates a mapping to zero-length string. Body bytes: case folding bytes lowercase mapping bytes uppercase mapping bytes titlecase mapping bytes closure mapping bytes (for NFKC_Casefold). (TODO) Fallbacks: missing fold -> lower missing title -> upper all missing -> original rune exceptions starts with a dummy byte to enforce that there is no zero index value.

const lengthMask = 0x07

lowerFunc var #

var lowerFunc = []mapFunc{...}

matcher var #

var matcher *internal.InheritanceMatcher

maxCaseMode const #

The case mode bits encodes the case type of a rune. This includes uncased, title, upper and lower case and case ignorable. (For a definition of these terms see Chapter 3 of The Unicode Standard Core Specification.) In some rare cases, a rune can be both cased and case-ignorable. This is encoded by cIgnorableCased. A rune of this type is always lower case. Some runes are cased while not having a mapping. A common pattern for scripts in the Unicode standard is for upper and lower case runes to alternate for increasing rune values (e.g. the accented Latin ranges starting from U+0100 and U+1E00 among others and some Cyrillic characters). We use this property by defining a cXORCase mode, where the case mode (always upper or lower case) is derived from the rune value. As the XOR pattern for case mappings is often identical for successive runes, using cXORCase can result in large series of identical trie values. This, in turn, allows us to better compress the trie blocks.

const maxCaseMode = cUpper

maxIgnorable const #

maxIgnorable defines the maximum number of ignorables to consider for lookahead operations.

const maxIgnorable = 30

noChange const #

The exceptions slice holds data that does not fit in a normal info entry. The entry is pointed to by the exception index in an entry. It has the following format: Header: byte 0: 7..6 unused 5..4 CCC type (same bits as entry) 3 unused 2..0 length of fold byte 1: 7..6 unused 5..3 length of 1st mapping of case type 2..0 length of 2nd mapping of case type case 1st 2nd lower -> upper, title upper -> lower, title title -> lower, upper Lengths with the value 0x7 indicate no value and implies no change. A length of 0 indicates a mapping to zero-length string. Body bytes: case folding bytes lowercase mapping bytes uppercase mapping bytes titlecase mapping bytes closure mapping bytes (for NFKC_Casefold). (TODO) Fallbacks: missing fold -> lower missing title -> upper all missing -> original rune exceptions starts with a dummy byte to enforce that there is no zero index value.

const noChange = 0

numExceptionBits const #

const numExceptionBits = 12

sparse var #

var sparse = sparseBlocks{...}

sparseOffsets var #

sparseOffsets: 289 entries, 578 bytes

var sparseOffsets = []uint16{...}

sparseOffsets var #

sparseOffsets: 296 entries, 592 bytes

var sparseOffsets = []uint16{...}

sparseOffsets var #

sparseOffsets: 277 entries, 554 bytes

var sparseOffsets = []uint16{...}

sparseOffsets var #

sparseOffsets: 272 entries, 544 bytes

var sparseOffsets = []uint16{...}

sparseOffsets var #

sparseOffsets: 282 entries, 564 bytes

var sparseOffsets = []uint16{...}

sparseOffsets var #

sparseOffsets: 312 entries, 624 bytes

var sparseOffsets = []uint16{...}

sparseValues var #

sparseValues: 1483 entries, 5932 bytes

var sparseValues = [1483]valueRange{...}

sparseValues var #

sparseValues: 1418 entries, 5672 bytes

var sparseValues = [1418]valueRange{...}

sparseValues var #

sparseValues: 1562 entries, 6248 bytes

var sparseValues = [1562]valueRange{...}

sparseValues var #

sparseValues: 1451 entries, 5804 bytes

var sparseValues = [1451]valueRange{...}

sparseValues var #

sparseValues: 1395 entries, 5580 bytes

var sparseValues = [1395]valueRange{...}

sparseValues var #

sparseValues: 1360 entries, 5440 bytes

var sparseValues = [1360]valueRange{...}

starter const #

const starter = 0

supported const #

supported lists the language tags for which we have tailorings.

const supported = "und af az el lt nl tr"

titleInfos var #

var titleInfos = []struct{...}{...}

trie var #

var trie = *ast.CallExpr

undLower var #

var undLower transform.SpanningTransformer = *ast.UnaryExpr

undLowerIgnoreSigma var #

var undLowerIgnoreSigma transform.SpanningTransformer = *ast.UnaryExpr

undUpper var #

var undUpper transform.SpanningTransformer = *ast.UnaryExpr

upperFunc var #

Some uppercase mappers are stateless, so we can precompute the Transformers and save a bit on runtime allocations.

var upperFunc = []struct{...}{...}

xorData var #

var xorData string = *ast.BinaryExpr

xorData var #

var xorData string = *ast.BinaryExpr

xorData var #

var xorData string = *ast.BinaryExpr

xorData var #

var xorData string = *ast.BinaryExpr

xorData var #

var xorData string = *ast.BinaryExpr

xorData var #

var xorData string = *ast.BinaryExpr

xorIndexBit const #

const xorIndexBit = *ast.BinaryExpr

xorShift const #

const xorShift = 8

Type Aliases

Option type #

An Option is used to modify the behavior of a Caser.

type Option func(o options) options

info type #

info holds case information for a single rune. It is the value returned by a trie lookup. Most mapping information can be stored in a single 16-bit value. If not, for example when a rune is mapped to multiple runes, the value stores some basic case data and an index into an array with additional data. The per-rune values have the following format: if (exception) { 15..4 unsigned exception index } else { 15..8 XOR pattern or index to XOR pattern for case mapping Only 13..8 are used for XOR patterns. 7 inverseFold (fold to upper, not to lower) 6 index: interpret the XOR pattern as an index or isMid if case mode is cIgnorableUncased. 5..4 CCC: zero (normal or break), above or other } 3 exception: interpret this value as an exception index (TODO: is this bit necessary? Probably implied from case mode.) 2..0 case mode For the non-exceptional cases, a rune must be either uncased, lowercase or uppercase. If the rune is cased, the XOR pattern maps either a lowercase rune to uppercase or an uppercase rune to lowercase (applied to the 10 least-significant bits of the rune). See the definitions below for a more detailed description of the various bits.

type info uint16

mapFunc type #

A mapFunc takes a context set to the current rune and writes the mapped version to the same context. It may advance the context to the next rune. It returns whether a checkpoint is possible: whether the pDst bytes written to dst so far won't need changing as we see more source bytes.

type mapFunc func(*context) bool

spanFunc type #

A spanFunc takes a context set to the current rune and returns whether this rune would be altered when written to the output. It may advance the context to the next rune. It returns whether a checkpoint is possible.

type spanFunc func(*context) bool

Structs

Caser struct #

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.

type Caser struct {
t transform.SpanningTransformer
}

caseFolder struct #

type caseFolder struct {
transform.NopResetter
}

caseTrie struct #

caseTrie. Total size: 11742 bytes (11.47 KiB). Checksum: 795fe57ee5135873.

type caseTrie struct {

}

caseTrie struct #

caseTrie. Total size: 12250 bytes (11.96 KiB). Checksum: 53ff6cb7321675e1.

type caseTrie struct {

}

caseTrie struct #

caseTrie. Total size: 13398 bytes (13.08 KiB). Checksum: 544af6e6b1b70931.

type caseTrie struct {

}

caseTrie struct #

caseTrie. Total size: 12396 bytes (12.11 KiB). Checksum: c0656238384c3da1.

type caseTrie struct {

}

caseTrie struct #

caseTrie. Total size: 11892 bytes (11.61 KiB). Checksum: c6f15484b7653775.

type caseTrie struct {

}

caseTrie struct #

caseTrie. Total size: 12538 bytes (12.24 KiB). Checksum: af4dfa7d60c71d4c.

type caseTrie struct {

}

context struct #

A context is used for iterating over source bytes, fetching case info and writing to a destination buffer. Casing operations may need more than one rune of context to decide how a rune should be cased. Casing implementations should call checkpoint on context whenever it is known to be safe to return the runes processed so far. It is recommended for implementations to not allow for more than 30 case ignorables as lookahead (analogous to the limit in norm) and to use state if unbounded lookahead is needed for cased runes.

type context struct {
dst []byte
src []byte
atEOF bool
pDst int
pSrc int
nDst int
nSrc int
err error
sz int
info info
isMidWord bool
}

lowerCaser struct #

lowerCaser implements the Transformer interface. The default Unicode lower casing requires different treatment for the first and subsequent characters of a word, most notably to handle the Greek final Sigma.

type lowerCaser struct {
undLowerIgnoreSigmaCaser
context
first mapFunc
midWord mapFunc
}

options struct #

type options struct {
noLower bool
simple bool
ignoreFinalSigma bool
}

simpleCaser struct #

type simpleCaser struct {
context
f mapFunc
span spanFunc
}

sparseBlocks struct #

type sparseBlocks struct {
values []valueRange
offsets []uint16
}

titleCaser struct #

titleCaser implements the Transformer interface. Title casing algorithms distinguish between the first letter of a word and subsequent letters of the same word. It uses state to avoid requiring a potentially infinite lookahead.

type titleCaser struct {
context
title mapFunc
lower mapFunc
titleSpan spanFunc
rewrite func(*context)
}

undLowerCaser struct #

undLowerCaser implements the Transformer interface for doing a lower case mapping for the root locale (und) ignoring final sigma handling. This casing algorithm is used in some performance-critical packages like secure/precis and x/net/http/idna, which warrants its special-casing.

type undLowerCaser struct {
transform.NopResetter
}

undLowerIgnoreSigmaCaser struct #

undLowerIgnoreSigmaCaser implements the Transformer interface for doing a lower case mapping for the root locale (und) ignoring final sigma handling. This casing algorithm is used in some performance-critical packages like secure/precis and x/net/http/idna, which warrants its special-casing.

type undLowerIgnoreSigmaCaser struct {
transform.NopResetter
}

undUpperCaser struct #

type undUpperCaser struct {
transform.NopResetter
}

valueRange struct #

valueRange is an entry in a sparse block.

type valueRange struct {
value uint16
lo byte
hi byte
}

Functions

Bytes method #

Bytes returns a new byte slice with the result of converting b to the case form implemented by c.

func (c Caser) Bytes(b []byte) []byte

Fold function #

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.

func Fold(opts ...Option) Caser

HandleFinalSigma function #

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.

func HandleFinalSigma(enable bool) Option

Lower function #

Lower returns a Caser for language-specific lowercasing.

func Lower(t language.Tag, opts ...Option) Caser

Reset method #

func (c *context) Reset()

Reset method #

Reset resets the Caser to be reused for new input after a previous call to Transform.

func (c Caser) Reset()

Span method #

func (t *titleCaser) Span(src []byte, atEOF bool) (n int, err error)

Span method #

func (t undUpperCaser) Span(src []byte, atEOF bool) (n int, err error)

Span method #

func (t undLowerCaser) Span(src []byte, atEOF bool) (n int, err error)

Span method #

Span implements the transform.SpanningTransformer interface.

func (c Caser) Span(src []byte, atEOF bool) (n int, err error)

Span method #

func (t *simpleCaser) Span(src []byte, atEOF bool) (n int, err error)

Span method #

Span implements a generic lower-casing. This is possible as isLower works for all lowercasing variants. All lowercase variants only vary in how they transform a non-lowercase letter. They will never change an already lowercase letter. In addition, there is no state.

func (t undLowerIgnoreSigmaCaser) Span(src []byte, atEOF bool) (n int, err error)

Span method #

func (t *caseFolder) Span(src []byte, atEOF bool) (n int, err error)

String method #

String returns a string with the result of transforming s to the case form implemented by c.

func (c Caser) String(s string) string

Title function #

Title returns a Caser for language-specific title casing. It uses an approximation of the default Unicode Word Break algorithm.

func Title(t language.Tag, opts ...Option) Caser

Transform method #

simpleCaser implements the Transformer interface for doing a case operation on a rune-by-rune basis.

func (t *simpleCaser) Transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)

Transform method #

Transform implements the transform.Transformer interface and transforms the given input to the case form implemented by c.

func (c Caser) Transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)

Transform method #

func (t undLowerIgnoreSigmaCaser) Transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)

Transform method #

caseFolder implements the Transformer interface for doing case folding.

func (t *caseFolder) Transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)

Transform method #

undUpperCaser implements the Transformer interface for doing an upper case mapping for the root locale (und). It eliminates the need for an allocation as it prevents escaping by not using function pointers.

func (t undUpperCaser) Transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)

Transform method #

func (t undLowerCaser) Transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)

Transform method #

func (t *lowerCaser) Transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)

Transform method #

Transform implements the standard Unicode title case algorithm as defined in Chapter 3 of The Unicode Standard: toTitlecase(X): Find the word boundaries in X according to Unicode Standard Annex #29, "Unicode Text Segmentation." For each word boundary, find the first cased character F following the word boundary. If F exists, map F to Titlecase_Mapping(F); then map all characters C between F and the following word boundary to Lowercase_Mapping(C).

func (t *titleCaser) Transform(dst []byte, src []byte, atEOF bool) (nDst int, nSrc int, err error)

Upper function #

Upper returns a Caser for language-specific uppercasing.

func Upper(t language.Tag, opts ...Option) Caser

afnlRewrite function #

Not part of CLDR, but see https://unicode.org/cldr/trac/ticket/7078.

func afnlRewrite(c *context)

aztrLower function #

func aztrLower(c *context) (done bool)

aztrUpper function #

func aztrUpper(f mapFunc) mapFunc

caseType method #

caseType returns an info with only the case bits, normalized to either cLower, cUpper, cTitle or cUncased.

func (c *context) caseType() info

cccType method #

func (c info) cccType() info

cccVal method #

func (c info) cccVal() info

checkpoint method #

checkpoint sets the return value buffer points for Transform to the current positions.

func (c *context) checkpoint()

compact function #

func compact(o options) options

copy method #

copy writes the current rune to dst.

func (c *context) copy() bool

copyXOR method #

copyXOR copies the current rune to dst and modifies it by applying the XOR pattern of the case info. It is the responsibility of the caller to ensure that this is a rune with a XOR pattern defined.

func (c *context) copyXOR() bool

doICU function #

func doICU(tag string, caser string, input string) string

elUpper function #

elUpper implements Greek upper casing, which entails removing a predefined set of non-blocked modifiers. Note that these accents should not be removed for title casing! Example: "Οδός" -> "ΟΔΟΣ".

func elUpper(c *context) bool

finalSigma function #

finalSigma adds Greek final Sigma handing to another casing function. It determines whether a lowercased sigma should be σ or ς, by looking ahead for case-ignorables and a cased letters.

func finalSigma(f mapFunc) mapFunc

finalSigmaBody function #

func finalSigmaBody(c *context) bool

foldFull function #

foldFull writes the foldFull version of the current rune to dst.

func foldFull(c *context) bool

getOpts function #

func getOpts(o ...Option) (res options)

handleFinalSigma function #

func handleFinalSigma(o options) options

hasPrefix method #

hasPrefix returns true if src[pSrc:] starts with the given string.

func (c *context) hasPrefix(s string) bool

ignoreFinalSigma function #

func ignoreFinalSigma(o options) options

init function #

func init()

isBreak method #

isBreak returns whether this rune should introduce a break.

func (c info) isBreak() bool

isCaseIgnorable method #

func (c info) isCaseIgnorable() bool

isCaseIgnorableAndNotCased method #

func (c info) isCaseIgnorableAndNotCased() bool

isCased method #

func (c info) isCased() bool

isFoldFull function #

isFoldFull reports whether the current run is mapped to foldFull

func isFoldFull(c *context) bool

isLetter method #

isLetter returns whether the rune is of break type ALetter, Hebrew_Letter, Numeric, ExtendNumLet, or Extend.

func (c info) isLetter() bool

isLower function #

func isLower(c *context) bool

isMid method #

func (c info) isMid() bool

isNotCasedAndNotCaseIgnorable method #

func (c info) isNotCasedAndNotCaseIgnorable() bool

isTitle function #

isTitle reports whether the current rune is in title case.

func isTitle(c *context) bool

isUpper function #

isUpper writes the isUppercase version of the current rune to dst.

func isUpper(c *context) bool

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the value from values block n for byte b using binary search.

func (s *sparseBlocks) lookup(n uint32, b byte) uint16

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookup(s []byte) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *caseTrie) lookupString(s string) (v uint16, sz int)

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupStringUnsafe(s string) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *caseTrie) lookupUnsafe(s []byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *caseTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *caseTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *caseTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *caseTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *caseTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *caseTrie) lookupValue(n uint32, b byte) uint16

lower function #

lower writes the lowercase version of the current rune to dst.

func lower(c *context) bool

ltLower function #

func ltLower(c *context) bool

ltUpper function #

func ltUpper(f mapFunc) mapFunc

makeFold function #

func makeFold(o options) transform.SpanningTransformer

makeLower function #

func makeLower(t language.Tag, o options) transform.SpanningTransformer

makeTitle function #

func makeTitle(t language.Tag, o options) transform.SpanningTransformer

makeUpper function #

func makeUpper(t language.Tag, o options) transform.SpanningTransformer

newCaseTrie function #

func newCaseTrie(i int) *caseTrie

newCaseTrie function #

func newCaseTrie(i int) *caseTrie

newCaseTrie function #

func newCaseTrie(i int) *caseTrie

newCaseTrie function #

func newCaseTrie(i int) *caseTrie

newCaseTrie function #

func newCaseTrie(i int) *caseTrie

newCaseTrie function #

func newCaseTrie(i int) *caseTrie

next method #

func (c *context) next() bool

nlTitle function #

func nlTitle(c *context) bool

nlTitleSpan function #

func nlTitleSpan(c *context) bool

noLower function #

func noLower(o options) options

noSpan function #

func noSpan(c *context) bool

ret method #

ret returns the return values for the Transform method. It checks whether there were insufficient bytes in src to complete and introduces an error accordingly, if necessary.

func (c *context) ret() (nDst int, nSrc int, err error)

retSpan method #

retSpan returns the return values for the Span method. It checks whether there were insufficient bytes in src to complete and introduces an error accordingly, if necessary.

func (c *context) retSpan() (n int, err error)

title function #

title writes the title case version of the current rune to dst.

func title(c *context) bool

unreadRune method #

unreadRune causes the last rune read by next to be reread on the next invocation of next. Only one unreadRune may be called after a call to next.

func (c *context) unreadRune()

upper function #

upper writes the uppercase version of the current rune to dst.

func upper(c *context) bool

writeBytes method #

writeBytes adds bytes to dst.

func (c *context) writeBytes(b []byte) bool

writeString method #

writeString writes the given string to dst.

func (c *context) writeString(s string) bool

Generated with Arrow