runerange

package
v0.0.0-...-17f25cd Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package runerange provides operations on rune ranges.

A rune range is a slice of pairs of runes where each pair represents all the runes from the first rune of the pair to the second one (inclusive). Thus, the range ['0', '9'] represents the runes '0', '1', '2', '3', '4', '5', '6', '7', '8', and '9'. The range ['0', '9', 'a', 'z'] represents the digits and the lowercase latin letters. A range containing a single rune 'a' is represented as ['a', 'a']. Rune pairs should be ordered by the unicode value of the first rune of the pair and should not intersect. The slices ['9', '0'], ['a', 'z', '0', '9'], ['a', 'o', 'b', 'z'] and ['a', 'b', 'c', 'z'] are not valid ranges.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(ranges []rune, r rune) []rune

Add adds a rune to the range (maybe modifying the original range) and returns the new range.

func Contains

func Contains(a, b []rune) bool

Contains returns true if the range a contains the range b.

func Fold

func Fold(ranges []rune) []rune

Fold returns a range containing all the runes from the original range and all the runes that can be obtained from them by using unicode case folding. The original range is not modified.

func In

func In(ranges []rune, r rune) bool

In returns true if a rune is in the range.

func Split

func Split(rs [][]rune) []rune

Split splits a set of ranges into a set of non-intersecting pairs so that each range in the set is a sum of some of the pairs.

func Sum

func Sum(a, b []rune) []rune

Sum returns a range containing all the runes from the ranges a and b. The a and b ranges are not modified.

Types

This section is empty.

Jump to

Keyboard shortcuts

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