bytescase

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: BSD-3-Clause Imports: 0 Imported by: 4

README

bytescase

Go Reference

The package bytescase implements ascii case insensitive matching and case conversion.

Documentation

Overview

Package bytescase implements ascii case insensitive matching and case conversion.

Index

Constants

This section is empty.

Variables

View Source
var ErrStr = [ErrLast]string{
	"no error",
	"not enough space in dst",
}

ErrStr is an array that maps error ids to error strings.

Functions

func ByteToLower

func ByteToLower(b byte) byte

ByteToLower converts one byte to ascii lower case.

func ByteToUpper

func ByteToUpper(b byte) byte

ByteToUpper converts one byte to upper case.

func CmpEq

func CmpEq(s1, s2 []byte) bool

CmpEq compares 2 byte slices for equality in case insensitive mode.

func Prefix

func Prefix(prefix, s []byte) (int, bool)

Prefix checks if s starts with prefix in case insensitive mode. Returns an index in s[] pointing after the matched prefix + true on success (e.g. len(prefix), true) or an index to the first non-matching character in s and false (e.g.: n, false) if the prefix is not fully contained in s.

If s==prefix the returned index will be len(s) and if prefix == [] the index will be 0. If prefix is longer then s the return will be 0, false.

func ToLower

func ToLower(src, dst []byte) error

ToLower converts src to lower case and writes it in dst. Returns error !=nill if not enough space in dst.

Types

type ErrorConv

type ErrorConv int32

ErrorConv is the type used for returning errors. It implements the Error interface.

const (
	NoErr ErrorConv = iota
	ErrDstNoSpc
	ErrLast
)

Error ids used when returning errors.

func (ErrorConv) Error

func (e ErrorConv) Error() string

Error() implements the error interface.

Jump to

Keyboard shortcuts

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