transform

package
v3.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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(v 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 MustParseCase added in v3.0.2

func MustParseCase(s string) Case

MustParseCase is similar to AsCase except that it panics on error.

func Of

func Of(lowercase, uppercase bool) Case

func (Case) Expression

func (c Case) Expression(s string) string

func (Case) IsValid

func (v Case) IsValid() bool

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

func (Case) Ordinal

func (v Case) Ordinal() int

Ordinal returns the ordinal number of a Case. This is an integer counting from zero. It is *not* the same as the const number assigned to the value.

func (*Case) Parse

func (v *Case) Parse(in 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 None. It is used by AsCase.

Usage Example

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

func (Case) String

func (v Case) String() string

String returns the literal string representation of a Case, which is the same as the const identifier but without prefix or suffix.

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