pair

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2015 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pair

type Pair struct {
	Key   string
	Value string
}

Pair represent a key-value pair

func Parse

func Parse(str, sep string) *Pair

Parse seperate string use first seperator string

func ParsePairWith

func ParsePairWith(str, sep string, sepIndexFn func(string, string) int) *Pair

ParsePairWith seperate string use given function

func Rparse

func Rparse(str, sep string) *Pair

Rparse seperate string use last seperator string

func (*Pair) BoolValue

func (p *Pair) BoolValue() (bool, error)

BoolValue convert pair's value to bool

func (*Pair) HasKey

func (p *Pair) HasKey() bool

HasKey check whether pair has key or not

func (*Pair) HasValue

func (p *Pair) HasValue() bool

HasValue check whether pair has value or not

func (*Pair) IntValue

func (p *Pair) IntValue() (int, error)

IntValue convert pair's value to int

func (*Pair) NoKey

func (p *Pair) NoKey() bool

NoKey check whether pair has key or not

func (*Pair) NoValue

func (p *Pair) NoValue() bool

NoValue check whether pair has value or not

func (*Pair) String

func (p *Pair) String() string

String return pair's display string, format as key=value

func (*Pair) Trim

func (p *Pair) Trim() *Pair

Trim trim all space of pair's key and value

func (*Pair) TrimQuote

func (p *Pair) TrimQuote() bool

TrimQuote trim quote for pair's key and value

func (*Pair) ValueOrKey

func (p *Pair) ValueOrKey() string

ValueOrKey return value when value is not "", otherwise return key

Jump to

Keyboard shortcuts

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