Help us shape the future of Go! Take the 2026 Go Developer Survey

caseconv

package
v2.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ToLowerTable = "" /* 729-byte string literal not displayed */
	ToUpperTable = "" /* 729-byte string literal not displayed */
)
View Source
const WordLen = swar.WordLen

WordLen is the SWAR word width in bytes, and the length from which these helpers are worth a call: below it the conversion is a table lookup per byte, cheaper inline. The case packages gate on it; the From converters require it.

Variables

This section is empty.

Functions

func FirstLowerIndex added in v2.1.2

func FirstLowerIndex(b []byte) int

FirstLowerIndex returns the index of the first ASCII lowercase byte in b, or -1 if b contains none. b is only ever read; it may be an unsafe view over immutable string memory.

func FirstUpperIndex added in v2.1.2

func FirstUpperIndex(b []byte) int

FirstUpperIndex returns the index of the first ASCII uppercase byte in b, or -1 if b contains none. b is only ever read; it may be an unsafe view over immutable string memory.

func ToLowerFrom added in v2.5.3

func ToLowerFrom(src []byte, first int) []byte

ToLowerFrom returns a lower-cased copy of src. first must be FirstUpperIndex's own result, with 0 <= first < len(src) and len(src) >= WordLen: a larger first silently mis-converts, so it must not be cached or derived elsewhere.

src is only read, so it may be an unsafe view over immutable string memory; the result is freshly allocated and unaliased. strings.ToLower needs both.

func ToLowerInPlace added in v2.1.2

func ToLowerInPlace(b []byte)

ToLowerInPlace lower-cases every ASCII uppercase byte of b in place: four words per pinned group, then single words, then bytes.

func ToUpperFrom added in v2.5.3

func ToUpperFrom(src []byte, first int) []byte

ToUpperFrom mirrors ToLowerFrom, with first from FirstLowerIndex.

func ToUpperInPlace added in v2.1.2

func ToUpperInPlace(b []byte)

ToUpperInPlace upper-cases every ASCII lowercase byte of b in place; the loop shape mirrors ToLowerInPlace.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL