transform

package
v2.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllCaseEnums = enum.IntEnums{
	Stet, Upper, Lower,
}

AllCaseEnums lists all 3 values in order.

View Source
var AllCases = []Case{
	Stet, Upper, Lower,
}

AllCases lists all 3 values in order.

Functions

This section is empty.

Types

type Case

type Case int
const (
	Stet Case = iota
	Upper
	Lower
)

func AsCase

func AsCase(s string) (Case, error)

AsCase parses a string to find the corresponding Case, accepting either one of the string values or a number. The input representation is determined by caseMarshalTextRep. It wraps Parse.

func CaseOf

func CaseOf(i int) Case

CaseOf returns a Case based on an ordinal number. This is the inverse of Ordinal. If the ordinal is out of range, an invalid Case is returned.

func Of

func Of(lowercase, uppercase bool) Case

func (Case) Expression

func (c Case) Expression(s string) string

func (Case) Int

func (i Case) Int() int

Int returns the int value, which is not necessarily the same as the ordinal. It serves to facilitate polymorphism (see enum.IntEnum).

func (Case) IsValid

func (i Case) IsValid() bool

IsValid determines whether a Case is one of the defined constants.

func (Case) Ordinal

func (i Case) Ordinal() int

Ordinal returns the ordinal number of a Case.

func (*Case) Parse

func (v *Case) Parse(s string) error

Parse parses a string to find the corresponding Case, accepting one of the string values or a number. The input representation is determined by caseMarshalTextRep. It is used by AsCase.

Usage Example

v := new(Case)
err := v.Parse(s)
...  etc

func (Case) String

func (i Case) String() string

String returns the literal string representation of a Case, which is the same as the const identifier.

func (Case) Tag

func (i Case) Tag() string

Tag returns the string representation of a Case. This is an alias for String.

func (Case) Transform

func (c Case) Transform(s string) string

Jump to

Keyboard shortcuts

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