string_view

package
v0.0.0-...-80698d3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Digit

func Digit() digit

func Letter

func Letter() letter

func Not

func Not(p predicate) not

func Or

func Or(p ...predicate) or

func String

func String(needle string) startsWith

func Whitespace

func Whitespace() whitespace

Types

type StringView

type StringView struct {
	// contains filtered or unexported fields
}

func New

func New(s *string) *StringView

func (*StringView) Length

func (view *StringView) Length() int

func (*StringView) Peak

func (view *StringView) Peak(p predicate) *StringView

Finds and returns the string from the current posision to the location of the first match of the predicate.

> Does not advance the offset

As with `StringView.Seek` this will search the current posision too. Consequentlely if the predicate matches the current posision, the resulting string will be empty.

func (*StringView) PeakNext

func (view *StringView) PeakNext(p predicate) *StringView

Finds and returns the string from the current posision to the location of the next match of the predicate.

> Does not advance the offset

func (*StringView) Seek

func (view *StringView) Seek(p predicate) *StringView

Seeks the provided predicate in the string.

If the predicate matches the current posision in the string, this does nothing

func (*StringView) SeekEndOf

func (view *StringView) SeekEndOf(p predicate) *StringView

Seeks the provided predicate in the string.

If the predicate matches the current posision in the string, this does nothing

func (*StringView) SeekNext

func (view *StringView) SeekNext(p predicate) *StringView

Seeks for the provided predicate in the string at any subsequent posision.

func (*StringView) SplitOnNext

func (view *StringView) SplitOnNext(p predicate) *StringView

func (*StringView) String

func (view *StringView) String() string

func (*StringView) Take

func (view *StringView) Take(n int) *StringView

func (*StringView) TakeLine

func (view *StringView) TakeLine() *StringView

Returns the result of `TakeUntil` any newline character, then `Seek` until the next non-empty line

func (*StringView) TakeUntil

func (view *StringView) TakeUntil(p predicate) *StringView

Finds and returns the string from the current posision to the location of the first match of the predicate.

As with `StringView.Seek` this will search the current posision too. Consequentlely if the predicate matches the current posision, the resulting string will be empty.

func (*StringView) TakeUntilNext

func (view *StringView) TakeUntilNext(p predicate) *StringView

Finds and returns the string from the current posision to the location of the first match of the predicate.

func (*StringView) TrimLeft

func (view *StringView) TrimLeft()

Trims away any whitespace from the left of the string.

Jump to

Keyboard shortcuts

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