helpers

package
v0.0.0-...-2acb6a5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: BSD-3-Clause, ISC, OpenSSL Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxRune         = '\U0010FFFF' // Maximum valid Unicode code point.
	ReplacementChar = '\uFFFD'     // Represents invalid code points.
	MaxASCII        = '\u007F'     // maximum ASCII value.
	MaxLatin1       = '\u00FF'     // maximum Latin-1 value.
)

Variables

View Source
var (
	Digit       = _Nd          // Nd is the set of Unicode characters in category Nd (Number, decimal digit).
	Letter      = _L           // Letter/L is the set of Unicode letters, category L.
	White_Space = _White_Space // White_Space is the set of Unicode characters with property White_Space.
)

Functions

func IsDigit

func IsDigit(r rune) bool

IsDigit reports whether the rune is a decimal digit.

func IsLetter

func IsLetter(r rune) bool

IsLetter reports whether the rune is a letter (category [L]).

func IsSpace

func IsSpace(r rune) bool

IsSpace reports whether the rune is a space character as defined by Unicode's White Space property; in the Latin-1 space this is

'\t', '\n', '\v', '\f', '\r', ' ', U+0085 (NEL), U+00A0 (NBSP).

Other definitions of spacing characters are set by category Z and property [Pattern_White_Space].

Types

type Range16

type Range16 struct {
	Lo     uint16
	Hi     uint16
	Stride uint16
}

Range16 represents of a range of 16-bit Unicode code points. The range runs from Lo to Hi inclusive and has the specified stride.

type Range32

type Range32 struct {
	Lo     uint32
	Hi     uint32
	Stride uint32
}

Range32 represents of a range of Unicode code points and is used when one or more of the values will not fit in 16 bits. The range runs from Lo to Hi inclusive and has the specified stride. Lo and Hi must always be >= 1<<16.

type RangeTable

type RangeTable struct {
	R16         []Range16
	R32         []Range32
	LatinOffset int // number of entries in R16 with Hi <= MaxLatin1
}

RangeTable defines a set of Unicode code points by listing the ranges of code points within the set. The ranges are listed in two slices to save space: a slice of 16-bit ranges and a slice of 32-bit ranges. The two slices must be in sorted order and non-overlapping. Also, R32 should contain only values >= 0x10000 (1<<16).

Jump to

Keyboard shortcuts

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