brackets

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BasicEnumImpl = rangesMap.BasicByte(
		coredynamic.TypeName(Invalid))
)

Functions

func HasBothWrappedWith

func HasBothWrappedWith(str string, category Category) bool

func UnWrapWith

func UnWrapWith(str string, category Category) string

UnWrapWith

Note : It doesn't care about in brackets exist in middle of (str), it just un-wrap from both sides if brackets are there.

func WrapWith

func WrapWith(str string, category Category, isSkipOnExists bool) string

WrapWith

if isSkipOnExists true then if both brackets are exist then skip the process or
if single is there then find the next one and apply (may not apply properly if missing)

Types

type BothBrackets

type BothBrackets struct {
	Start, End Bracket
	Category   Category
	IsInvalid  bool
}

func (*BothBrackets) IsSafeInvalid

func (it *BothBrackets) IsSafeInvalid() bool

func (*BothBrackets) IsValid

func (it *BothBrackets) IsValid() bool

func (BothBrackets) IsWrapped

func (it BothBrackets) IsWrapped(source string) bool

func (BothBrackets) String

func (it BothBrackets) String() string

func (BothBrackets) UnWrap

func (it BothBrackets) UnWrap(source string) string

func (BothBrackets) WrapAny

func (it BothBrackets) WrapAny(source interface{}) string

func (BothBrackets) WrapFmtString

func (it BothBrackets) WrapFmtString(
	format, sourceString string,
) string

WrapFmtString

{wrapped} will be replaced in the
format by the wrapped string.

func (BothBrackets) WrapSkipOnExist

func (it BothBrackets) WrapSkipOnExist(
	source string,
) string

func (BothBrackets) WrapString

func (it BothBrackets) WrapString(sourceString string) string

func (BothBrackets) WrapWithOptions

func (it BothBrackets) WrapWithOptions(
	isSkipOnExist bool,
	source string,
) string

type Bracket

type Bracket byte
const (
	Invalid          Bracket = iota
	ParenthesisStart Bracket = '('
	ParenthesisEnd   Bracket = ')'
	CurlyStart       Bracket = '{'
	CurlyEnd         Bracket = '}'
	SquareStart      Bracket = '['
	SquareEnd        Bracket = ']'
)

func (Bracket) AllNameValues

func (it Bracket) AllNameValues() []string

func (Bracket) AsBasicByteEnumContractsBinder

func (it Bracket) AsBasicByteEnumContractsBinder() enuminf.BasicByteEnumContractsBinder

func (*Bracket) AsBasicEnumContractsBinder

func (it *Bracket) AsBasicEnumContractsBinder() enuminf.BasicEnumContractsBinder

func (Bracket) BothBrackets

func (it Bracket) BothBrackets() BothBrackets

func (Bracket) Category

func (it Bracket) Category() Category

func (Bracket) EnumType

func (it Bracket) EnumType() enuminf.EnumTyper

func (Bracket) Format

func (it Bracket) Format(format string) (compiled string)

func (Bracket) IntegerEnumRanges

func (it Bracket) IntegerEnumRanges() []int

func (Bracket) IsAnyNamesOf

func (it Bracket) IsAnyNamesOf(names ...string) bool

func (Bracket) IsAnyOf

func (it Bracket) IsAnyOf(anyOfItems ...Bracket) bool

func (Bracket) IsAnyValuesEqual

func (it Bracket) IsAnyValuesEqual(anyByteValues ...byte) bool

func (Bracket) IsByteValueEqual

func (it Bracket) IsByteValueEqual(value byte) bool

func (Bracket) IsCurly

func (it Bracket) IsCurly() bool

func (Bracket) IsCurlyEnd

func (it Bracket) IsCurlyEnd() bool

func (Bracket) IsCurlyStart

func (it Bracket) IsCurlyStart() bool

func (Bracket) IsEnd

func (it Bracket) IsEnd() bool

func (Bracket) IsEqual

func (it Bracket) IsEqual(char uint8) bool

func (Bracket) IsInvalid

func (it Bracket) IsInvalid() bool

func (Bracket) IsNameEqual

func (it Bracket) IsNameEqual(name string) bool

func (Bracket) IsNameOf

func (it Bracket) IsNameOf(anyNames ...string) bool

func (Bracket) IsParenthesis

func (it Bracket) IsParenthesis() bool

func (Bracket) IsParenthesisEnd

func (it Bracket) IsParenthesisEnd() bool

func (Bracket) IsParenthesisStart

func (it Bracket) IsParenthesisStart() bool

func (Bracket) IsSquare

func (it Bracket) IsSquare() bool

func (Bracket) IsSquareEnd

func (it Bracket) IsSquareEnd() bool

func (Bracket) IsSquareStart

func (it Bracket) IsSquareStart() bool

func (Bracket) IsStart

func (it Bracket) IsStart() bool

func (Bracket) IsValid

func (it Bracket) IsValid() bool

func (Bracket) IsValueEqual

func (it Bracket) IsValueEqual(value byte) bool

func (Bracket) IsWrapped

func (it Bracket) IsWrapped(
	source string,
) bool

func (Bracket) MarshalJSON

func (it Bracket) MarshalJSON() ([]byte, error)

func (Bracket) MaxByte

func (it Bracket) MaxByte() byte

func (Bracket) MaxInt

func (it Bracket) MaxInt() int

func (Bracket) MaxValueString

func (it Bracket) MaxValueString() string

func (Bracket) MinByte

func (it Bracket) MinByte() byte

func (Bracket) MinInt

func (it Bracket) MinInt() int

func (Bracket) MinMaxAny added in v0.1.3

func (it Bracket) MinMaxAny() (min, max interface{})

func (Bracket) MinValueString

func (it Bracket) MinValueString() string

func (Bracket) Name

func (it Bracket) Name() string

func (Bracket) NameValue

func (it Bracket) NameValue() string

func (Bracket) OnlySupportedErr

func (it Bracket) OnlySupportedErr(names ...string) error

func (Bracket) OnlySupportedMsgErr

func (it Bracket) OnlySupportedMsgErr(message string, names ...string) error

func (Bracket) OtherBracket

func (it Bracket) OtherBracket() Bracket

func (Bracket) Pair

func (it Bracket) Pair() Pair

func (Bracket) RangeNamesCsv

func (it Bracket) RangeNamesCsv() string

func (Bracket) RangesByte

func (it Bracket) RangesByte() []byte

func (Bracket) RangesDynamicMap

func (it Bracket) RangesDynamicMap() map[string]interface{}

func (Bracket) SelfWrap

func (it Bracket) SelfWrap() string

func (Bracket) String

func (it Bracket) String() string

func (*Bracket) ToNumberString

func (it *Bracket) ToNumberString() string

func (Bracket) ToPtr

func (it Bracket) ToPtr() *Bracket

func (Bracket) TypeName

func (it Bracket) TypeName() string

func (Bracket) UnWrap

func (it Bracket) UnWrap(
	source string,
) string

func (*Bracket) UnmarshalJSON

func (it *Bracket) UnmarshalJSON(data []byte) error

func (*Bracket) UnmarshallEnumToValue

func (it *Bracket) UnmarshallEnumToValue(
	jsonUnmarshallingValue []byte,
) (byte, error)

func (Bracket) Value

func (it Bracket) Value() byte

func (Bracket) ValueByte

func (it Bracket) ValueByte() byte

func (Bracket) ValueInt

func (it Bracket) ValueInt() int

func (Bracket) ValueInt16

func (it Bracket) ValueInt16() int16

func (Bracket) ValueInt32

func (it Bracket) ValueInt32() int32

func (Bracket) ValueInt8

func (it Bracket) ValueInt8() int8

func (Bracket) ValueString

func (it Bracket) ValueString() string

func (Bracket) ValueUInt16

func (it Bracket) ValueUInt16() uint16

func (Bracket) WrapAny

func (it Bracket) WrapAny(source interface{}) string

func (Bracket) WrapFmtString

func (it Bracket) WrapFmtString(
	format, sourceString string,
) string

WrapFmtString

{wrapped} will be replaced in the
format by the wrapped string.

func (Bracket) WrapRegardless

func (it Bracket) WrapRegardless(
	source string,
) string

func (Bracket) WrapSkipOnExist

func (it Bracket) WrapSkipOnExist(
	source string,
) string

func (Bracket) WrapString

func (it Bracket) WrapString(
	sourceString string,
) string

func (Bracket) WrapWithOptions

func (it Bracket) WrapWithOptions(
	isSkipOnExist bool,
	source string,
) string

type BracketStatus

type BracketStatus struct {
	IsBracketFound bool
	IsLeft         bool
	Category       Category
	FoundBracket   Bracket
	OtherBracket   Bracket
}

func EmptyBracketStatus

func EmptyBracketStatus() BracketStatus

func WhichBracket

func WhichBracket(char uint8, isLeft bool) BracketStatus

type Category

type Category byte
const (
	UnknownCategory Category = iota
	Parenthesis
	Curly
	Square
)

func (Category) AsSimpleEnumer

func (it Category) AsSimpleEnumer() enuminf.SimpleEnumer

func (Category) End

func (it Category) End() Bracket

func (Category) IsCurly

func (it Category) IsCurly() bool

func (Category) IsInvalid

func (it Category) IsInvalid() bool

func (Category) IsParenthesis

func (it Category) IsParenthesis() bool

func (Category) IsSquare

func (it Category) IsSquare() bool

func (Category) IsValid

func (it Category) IsValid() bool

func (Category) IsWrapped

func (it Category) IsWrapped(source string) bool

func (Category) Name

func (it Category) Name() string

func (Category) Pair

func (it Category) Pair() Pair

func (Category) SelfWrap

func (it Category) SelfWrap() string

func (Category) Start

func (it Category) Start() Bracket

func (Category) String

func (it Category) String() string

func (Category) TypeName

func (it Category) TypeName() string

func (Category) UnWrap

func (it Category) UnWrap(source string) string

func (Category) ValueByte

func (it Category) ValueByte() byte

func (Category) WrapAny

func (it Category) WrapAny(source interface{}) string

func (Category) WrapFmtString

func (it Category) WrapFmtString(
	format, sourceString string,
) string

WrapFmtString

{wrapped} will be replaced in the
format by the wrapped string.

func (Category) WrapString

func (it Category) WrapString(sourceString string) string

func (Category) WrapWithOptions

func (it Category) WrapWithOptions(
	isSkipOnExist bool,
	source string,
) string

type Pair

type Pair struct {
	Start    Bracket
	End      Bracket
	Category Category
}

func (*Pair) IsSafeInvalid

func (it *Pair) IsSafeInvalid() bool

func (*Pair) IsValid

func (it *Pair) IsValid() bool

func (Pair) IsWrapped

func (it Pair) IsWrapped(source string) bool

func (Pair) SelfWrap

func (it Pair) SelfWrap() string

func (Pair) String

func (it Pair) String() string

func (Pair) UnWrap

func (it Pair) UnWrap(source string) string

func (Pair) Wrap

func (it Pair) Wrap(str string) string

func (Pair) WrapAny

func (it Pair) WrapAny(source interface{}) string

func (Pair) WrapFmtString

func (it Pair) WrapFmtString(
	format, sourceString string,
) string

WrapFmtString

{wrapped} will be replaced in
the format by the wrapped string.

func (Pair) WrapSkipOnExist

func (it Pair) WrapSkipOnExist(
	source string,
) string

func (Pair) WrapString

func (it Pair) WrapString(sourceString string) string

func (Pair) WrapWithOptions

func (it Pair) WrapWithOptions(
	isSkipOnExist bool,
	source string,
) string

Jump to

Keyboard shortcuts

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