text

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToTitle

func ToTitle(word string) string

Types

type CaseFormat

type CaseFormat string

CaseFormat defines case format

const (
	CaseFormatUndefined                  = ""
	CaseFormatUpper           CaseFormat = "upper"
	CaseFormatLower           CaseFormat = "lower"
	CaseFormatUpperCamel      CaseFormat = "upperCamel"
	CaseFormatLowerCamel      CaseFormat = "lowerCamel"
	CaseFormatTitle           CaseFormat = "title"
	CaseFormatSentence        CaseFormat = "sentence"
	CaseFormatUpperUnderscore CaseFormat = "upperUnderscore"
	CaseFormatLowerUnderscore CaseFormat = "lowerUnderscore"
	CaseFormatDash            CaseFormat = "dash"
	CaseFormatLowerDash       CaseFormat = "lowerdash"
	CaseFormatUpperDash       CaseFormat = "upperdash"
)

func DetectCaseFormat

func DetectCaseFormat(words ...string) CaseFormat

func NewCaseFormat

func NewCaseFormat(name string) CaseFormat

func (CaseFormat) Format added in v0.5.1

func (c CaseFormat) Format(text string, caseFormat CaseFormat) string

func (CaseFormat) Index

func (c CaseFormat) Index() int

func (CaseFormat) IsDefined

func (c CaseFormat) IsDefined() bool

IsDefined returns true if case format is defined

func (CaseFormat) To

type CaseFormatter

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

CaseFormatter defines words case formatter

func (*CaseFormatter) Format

func (c *CaseFormatter) Format(src string) string

Format converts source to desired case format

func (*CaseFormatter) To

func (c *CaseFormatter) To() CaseFormat

Jump to

Keyboard shortcuts

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