util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CharacterCount

func CharacterCount(b []byte) int

CharacterCount returns the number of characters in a byte array Similar to utf8.RuneCount but for unicode characters

func CharacterCountInString

func CharacterCountInString(str string) int

CharacterCountInString returns the number of characters in a string Similar to utf8.RuneCountInString but for unicode characters

func Clamp

func Clamp(val, min, max int) int

Clamp clamps a value between min and max

func DecodeCharacter

func DecodeCharacter(b []byte) (rune, []rune, int)

DecodeCharacter returns the next character from an array of bytes A character is a rune along with any accompanying combining runes

func DecodeCharacterInString

func DecodeCharacterInString(str string) (rune, []rune, int)

DecodeCharacterInString returns the next character from a string A character is a rune along with any accompanying combining runes

func RunePos

func RunePos(b []byte, i int) int

RunePos returns the rune index of a given byte index Make sure the byte index is not between code points

func SliceEnd

func SliceEnd(slc []byte, index int) []byte

SliceEnd returns a byte slice where the index is a rune index Slices off the start of the slice

func SliceStart

func SliceStart(slc []byte, index int) []byte

SliceStart returns a byte slice where the index is a rune index Slices off the end of the slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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