stringsutil

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeHexPair added in v0.31.0

func DecodeHexPair(hi, lo byte) (byte, bool)

DecodeHexPair decodes two ASCII hexadecimal digits into a byte. It returns false if either character is not a hexadecimal digit.

func EqualASCIIIgnoreCase

func EqualASCIIIgnoreCase(s, t uint8) bool

EqualASCIIIgnoreCase performs case-insensitive comparison of two ASCII bytes. Only supports ASCII letters (A-Z, a-z), digits (0-9), hyphen (-) and underscore (_). Used for hostname matching where registered routes follow LDH standard.

func EqualStringsASCIIIgnoreCase

func EqualStringsASCIIIgnoreCase(s1, s2 string) bool

EqualStringsASCIIIgnoreCase performs case-insensitive comparison of two strings containing ASCII characters. Only supports ASCII letters (A-Z, a-z), digits (0-9), hyphen (-) and underscore (_). Used for hostname matching where registered routes follow LDH standard.

func EscapePath added in v0.31.0

func EscapePath(path string) string

EscapePath returns the default encoding of a decoded URL path. It mirrors net/url.URL.EscapedPath for an unset RawPath, including the Path == "*" special case.

func IsRoutableRaw added in v0.31.0

func IsRoutableRaw(b byte) bool

IsRoutableRaw reports whether b is allowed unescaped in a routing path, i.e. whether NormalizeRawPath can emit it unescaped.

func IsUnreserved added in v0.31.0

func IsUnreserved(b byte) bool

IsUnreserved reports whether b is an RFC 3986 unreserved character: ALPHA / DIGIT / "-" / "." / "_" / "~". Unreserved characters are the only ones that can be safely percent-decoded without changing the meaning of a URI.

func NormalizeRawPath added in v0.31.0

func NormalizeRawPath(raw, path string) (norm string, wellFormed bool)

NormalizeRawPath returns the canonical routing form of an escaped path. Unreserved escapes are decoded, hex is uppercased and bytes that must be escaped in a path are percent-encoded in place. wellFormed reports that no such byte was found. In that case norm differs from raw only by hex case or by a decoded unreserved escape, and RFC 3986 guarantees that both forms identify the same resource. A transformation that breaks this guarantee must report wellFormed false. It returns "" when raw contains a malformed escape or is not an encoding of path. The routing form must then be derived from path.

func ToLowerASCII

func ToLowerASCII(b byte) byte

ToLowerASCII converts an ASCII uppercase letter (A-Z) to lowercase (a-z). All other bytes are returned unchanged. Does not validate ASCII range.

func UpperHex added in v0.31.0

func UpperHex(c byte) byte

UpperHex converts an ASCII lowercase hexadecimal digit (a-f) to uppercase (A-F). All other bytes are returned unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

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