xstrings

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package xstrings provides additional iterator functions for working with strings. Functions from this package will become a part of the Go standard library in Go 1.24, when this package functions will be deprecated and eventually removed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lines

func Lines(s string) iter.Seq[string]

Lines returns an iterator over the newline-terminated lines in the string s. The lines yielded by the iterator include their terminating newlines. If s is empty, the iterator yields no lines at all. If s does not end in a newline, the final yielded line will not end in a newline. It returns a single-use iterator.

func SplitAfterSeq

func SplitAfterSeq(s, sep string) iter.Seq[string]

SplitAfterSeq returns an iterator over substrings of s split after each instance of sep. The iterator yields the same strings that would be returned by SplitAfter(s, sep), but without constructing the slice. It returns a single-use iterator.

func SplitSeq

func SplitSeq(s, sep string) iter.Seq[string]

SplitSeq returns an iterator over all substrings of s separated by sep. The iterator yields the same strings that would be returned by Split(s, sep), but without constructing the slice. It returns a single-use iterator.

Types

This section is empty.

Jump to

Keyboard shortcuts

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