shellwords

package
v0.0.0-...-290008c Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddQuoteIfNeeded

func AddQuoteIfNeeded(s string) string

func NeedQuote

func NeedQuote(s string) bool

func Split

func Split(str string) []string

Split is a conveinence method for splitting a string into tokens. It is equivalent to the code:

New(str).Split()

Types

type Splitter

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

Splitter is used to split an input string into tokens.

func New

func New(str string) *Splitter

New creates a new splitter for a given string.

func (*Splitter) Next

func (s *Splitter) Next() (token string, hasToken bool)

Next returns the next token from the splitter. This returns the token and whether or not the token was successfully scanned. If the end of the string is encountered, the second return value will be false.

func (*Splitter) Split

func (s *Splitter) Split() []string

Split scans until the end of the string and return the remaining tokens as a slice. If no more tokens are present, this returns an empty slice.

Jump to

Keyboard shortcuts

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