utils

package
v0.0.0-...-5a663d6 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package utils provides public utility functions that are used by other functions within the module. Their interfaces are considered stable once released and can be imported into other modules.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPattern = errors.New("invalid pattern format")

ErrInvalidPattern is returned for non-conforming patterns.

Functions

func ExpandSeq

func ExpandSeq(pattern string) ([]string, error)

ExpandSeq takes in a string sequence pattern and returns a string slice of the pattern expanded. The format of the pattern is `START..END[..INCR]`.

Examples:

"1..5"      -> []string{"1", "2", "3", "4", "5"}
"a..e"      -> []string{"a", "b", "c", "d", "e"}
"10..18..2" -> []string{"10", "12", "14", "16", "18"}
"a..z..3"   -> []string{"a", "d", "g", "j", "m", "p", "s", "v", "y"}

For rune patterns, unicode ordering is preserved `z..|` equates to `[]string{"z", "{", "|"}`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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