Documentation ¶
Index ¶
- func Camel(s string) string
- func Constant(s string) string
- func Dash(s string) string
- func Dot(s string) string
- func Pascal(s string) string
- func Simple(s string) string
- func Snake(s string) string
- type CaseConverter
- type CaseOptFunc
- type CaseOpts
- type IgnoreFunc
- type IndicatorFunc
- type SentenceConverter
- type TitleConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CaseConverter ¶ added in v0.6.0
A CaseConverter converts a string to a specific case.
type CaseOptFunc ¶ added in v0.6.0
type CaseOptFunc func(opts *CaseOpts)
CaseOptFunc is a function that modifies a CaseConverter.
func UsingIndicator ¶
func UsingIndicator(indicator IndicatorFunc) CaseOptFunc
UsingIndicator sets the indicator for the CaseConverter.
func UsingPrefix ¶ added in v0.9.0
func UsingPrefix(prefix string) CaseOptFunc
UsingPrefix sets the prefix for the CaseConverter.
func UsingVocab ¶
func UsingVocab(vocab []string) CaseOptFunc
UsingVocab sets the vocab for the CaseConverter.
type CaseOpts ¶ added in v0.6.0
type CaseOpts struct {
// contains filtered or unexported fields
}
CaseOpts is a struct that holds the options for a CaseConverter.
type IgnoreFunc ¶
An IgnoreFunc is a TitleConverter callback that decides whether or not the the string word should be capitalized. firstOrLast indicates whether or not word is the first or last word in the given string.
var ( APStyle IgnoreFunc = optionsAP ChicagoStyle IgnoreFunc = optionsChicago )
type IndicatorFunc ¶
An IndicatorFunc is a SentenceConverter callback that decides whether or not the string word should be capitalized.
type SentenceConverter ¶
type SentenceConverter struct {
CaseOpts
}
A SentenceConverter converts a string to sentence case.
func NewSentenceConverter ¶
func NewSentenceConverter(opts ...CaseOptFunc) *SentenceConverter
NewSentenceConverter returns a new SentenceConverter.
func (*SentenceConverter) Convert ¶ added in v0.6.0
func (sc *SentenceConverter) Convert(s string) string
Convert returns a copy of the string s in sentence case format.
type TitleConverter ¶
type TitleConverter struct { CaseOpts // contains filtered or unexported fields }
A TitleConverter converts a string to title case according to its style.
func NewTitleConverter ¶
func NewTitleConverter(style IgnoreFunc, opts ...CaseOptFunc) *TitleConverter
NewTitleConverter returns a new TitleConverter set to enforce the specified style.
func (*TitleConverter) Convert ¶ added in v0.6.0
func (tc *TitleConverter) Convert(s string) string
Convert returns a copy of the string s in title case format.