Documentation ¶
Overview ¶
Range functions for Go. Easily generate intervals of integers, floats, runes, and strings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Range ¶ added in v0.0.2
Returns an interval slice of numbers, with the specified start and end value. Values between the start and end are incremented ("stepped") by 1, unless a different step option is provided. If the end value is smaller than the start value, returns an empty slice.
func Rune ¶
Returns an interval slice of runes, with the specified start and end value. Runes are incremented by adding an integer step value to the rune's integer value, and casting that value back into a rune. The step value is 1, unless a different step option is provided. If the end value is smaller than the start value, returns an empty slice.
func Step ¶
func Step[N Number](size N) func(*options[N])
The Step option changes the increment ("step") between values in generated intervals. If this option is omitted, the step defaults to 1.
func String ¶
Returns an interval slice of strings. Under the hood, this generates an interval of runes and casts them to strings. For that reason, starting and ending strings cannot be empty and must contain a single character, or an error is returned. The step value is 1, unless a different step option is provided. If the end value is smaller than the start value, returns an empty slice.
Types ¶
type Number ¶ added in v0.0.2
type Number interface { constraints.Integer | constraints.Float }