str

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(str string) bool

Bool returns the bool equivalent of str ("true" = true, etc) A parsing error will cause a program panic.

func Float64

func Float64(str string) float64

Float64 returns the float64 representation of str. A parsing error will cause a program panic.

func Int

func Int(str string) int

Int returns the int representation of str. A parsing error will cause a program panic.

func IsEmpty

func IsEmpty(str string) bool

IsEmpty tests for str == ""

func SplitLines

func SplitLines(str string) []string

SplitLines splits each line from str into []string

func SplitSpaces

func SplitSpaces(str string) []string

SplitSpaces splits str by blank chars (space,\t,\n)

Types

type Str

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

Str represents a string value

func String

func String(str string) *Str

String is constructor function that returns *Str

func StringWithVars added in v0.3.0

func StringWithVars(str string, variables *vars.Variables) *Str

StringWithVars sets session variables and calls func String

func (*Str) Bool

func (s *Str) Bool() bool

Bool converts s.val from string to a bool representation Check s.Err() for parsing errors

func (*Str) Bytes

func (s *Str) Bytes() []byte

Bytes returns []byte(s.val)

func (*Str) Concat

func (s *Str) Concat(vals ...string) *Str

Concat concatenates val1 to s.val

func (*Str) CopyTo

func (s *Str) CopyTo(dest io.Writer) *Str

CopyTo copies s.val unto dest Check s.Error() for copy error.

func (*Str) Eq

func (s *Str) Eq(val1 string) bool

Eq returns true if both strings are equal

func (*Str) Err

func (s *Str) Err() error

Err returns any captured error

func (*Str) Float64

func (s *Str) Float64() float64

Float64 converts s.val from string to a float64 representation Check s.Error() for parsing errors

func (*Str) Int

func (s *Str) Int() int

Int converts s.val from string to a int representation Check s.Err() for parsing errors

func (*Str) IsEmpty

func (s *Str) IsEmpty() bool

IsEmpty returns true if len(s) == 0

func (*Str) Reader

func (s *Str) Reader() io.Reader

Reader returns an io.Reader to access the content.

func (*Str) ReplaceAll

func (s *Str) ReplaceAll(old, new string) *Str

ReplaceAll replaces all occurrences of old with new in s.val

func (*Str) Split

func (s *Str) Split(sep string) []string

Split s.val using the sep as delimiter

func (*Str) SplitLines

func (s *Str) SplitLines() []string

SplitLines splits s.val using \n as delimiter

func (*Str) SplitRegex

func (s *Str) SplitRegex(exp string) []string

SplitRegex uses regular expression exp to split s.val

func (*Str) SplitSpaces

func (s *Str) SplitSpaces() []string

SplitSpaces properly splits s.val into []elements separated by one or more Unicode.IsSpace characters i.e. SplitSpaces("ab cd e\tf\ng") returns 5 elements

func (*Str) String

func (s *Str) String() string

String returns the string value

func (*Str) ToLower

func (s *Str) ToLower() *Str

ToLower returns val as lower case

func (*Str) ToTitle

func (s *Str) ToTitle() *Str

ToTitle returns strings.ToTitle for s.val

func (*Str) ToUpper

func (s *Str) ToUpper() *Str

ToUpper returns val as upper case

func (*Str) Trim

func (s *Str) Trim(cutset string) *Str

Trim removes each character in cutset from around s.val

func (*Str) TrimLeft

func (s *Str) TrimLeft(cutset string) *Str

TrimLeft removes each character in cutset at the start of s.val

func (*Str) TrimRight

func (s *Str) TrimRight(cutset string) *Str

TrimRight removes each character in cutset removed at the start of s.val

func (*Str) TrimSpaces

func (s *Str) TrimSpaces() *Str

TrimSpaces removes spaces around a val

Jump to

Keyboard shortcuts

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