runes

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package runes provides a small subset of functions for rune slices that are found in the strings and bytes standard packages. For rendering and other logic, it is best to keep raw data in runes, and not having to convert back and forth to bytes or strings is more efficient.

These are largely copied from the strings or bytes packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualFold

func EqualFold(s, t []rune) bool

EqualFold reports whether s and t are equal under Unicode case-folding. copied from strings.EqualFold

func Index

func Index(txt, find []rune) int

Index returns the index of given rune string in the text, returning -1 if not found.

func IndexFold

func IndexFold(txt, find []rune) int

IndexFold returns the index of given rune string in the text, using case folding (i.e., case insensitive matching). Returns -1 if not found.

func Repeat

func Repeat(r []rune, count int) []rune

Repeat returns a new rune slice consisting of count copies of b.

It panics if count is negative or if the result of (len(b) * count) overflows.

func SetFromBytes added in v0.3.0

func SetFromBytes(rs []rune, s []byte) []rune

SetFromBytes sets slice of runes from given slice of bytes, using efficient memory reallocation of existing slice. returns potentially modified slice: use assign to update.

Types

This section is empty.

Jump to

Keyboard shortcuts

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