caseconversion

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeCasePreservingSnakeCase

func EncodeCasePreservingSnakeCase(words DecodedIdentifier) string

EncodeCasePreservingSnakeCase encodes a slice of words into case_Preserving_snake_case

func EncodeKebabCase

func EncodeKebabCase(words DecodedIdentifier) string

EncodeKebabCase encodes a slice of words into kebab-case

func EncodeLowerCamelCase

func EncodeLowerCamelCase(words DecodedIdentifier) string

EncodeLowerCamelCase encodes a slice of words into lowerCamelCase

func EncodeLowerSnakeCase

func EncodeLowerSnakeCase(words DecodedIdentifier) string

EncodeLowerSnakeCase encodes a slice of words into lower_snake_case

func EncodeUpperCamelCase

func EncodeUpperCamelCase(words DecodedIdentifier) string

EncodeUpperCamelCase encodes a slice of words into UpperCamelCase

func EncodeUpperSnakeCase

func EncodeUpperSnakeCase(words DecodedIdentifier) string

EncodeUpperSnakeCase encodes a slice of words into UPPER_SNAKE_CASE (AKA SCREAMING_SNAKE_CASE)

Types

type DecodeCasingFunc

type DecodeCasingFunc func(string) (DecodedIdentifier, error)

DecodeCasingFunc takes in an identifier in a case such as camelCase or snake_case and splits it up into a DecodedIdentifier for encoding by an EncodeCasingFunc into a different case.

type DecodedIdentifier

type DecodedIdentifier []string

DecodedIdentifier is an slice of lowercase words (e.g., []string{"test", "string"}) produced by a DecodeCasingFunc, which can be encoded by an EncodeCasingFunc into a string in the specified case (e.g., with EncodeLowerCamelCase, "testString").

func DecodeCasePreservingSnakeCase

func DecodeCasePreservingSnakeCase(s string) (DecodedIdentifier, error)

DecodeCasePreservingSnakeCase decodes Case_Preserving_Snake_Case into a slice of lower-cased sub-string

func DecodeGoCamelCase

func DecodeGoCamelCase(s string) (DecodedIdentifier, error)

DecodeGoCamelCase decodes UpperCamelCase and lowerCamelCase strings with fully capitalized acronyms (e.g., "jsonAPIDocs") into a slice of lower-cased sub-strings.

func DecodeGoTags

func DecodeGoTags(s string) (DecodedIdentifier, error)

DecodeGoTags decodes CamelCase, snake_case, and kebab-case strings with fully capitalized acronyms into a slice of lower cased strings.

func DecodeKebabCase

func DecodeKebabCase(s string) (DecodedIdentifier, error)

DecodeKebabCase decodes kebab-case into a slice of lower-cased sub-strings

func DecodeLowerCamelCase

func DecodeLowerCamelCase(s string) (DecodedIdentifier, error)

DecodeLowerCamelCase decodes lowerCamelCase strings into a slice of lower-cased sub-strings

func DecodeLowerSnakeCase

func DecodeLowerSnakeCase(s string) (DecodedIdentifier, error)

DecodeLowerSnakeCase decodes lower_snake_case into a slice of lower-cased sub-strings

func DecodeUpperCamelCase

func DecodeUpperCamelCase(s string) (DecodedIdentifier, error)

DecodeUpperCamelCase decodes UpperCamelCase strings into a slice of lower-cased sub-strings

func DecodeUpperSnakeCase

func DecodeUpperSnakeCase(s string) (DecodedIdentifier, error)

DecodeUpperSnakeCase decodes UPPER_SNAKE_CASE (sometimes called SCREAMING_SNAKE_CASE) into a slice of lower-cased sub-strings

type EncodeCasingFunc

type EncodeCasingFunc func(DecodedIdentifier) string

EncodeCasingFunc combines the contents of a DecodedIdentifier into an identifier in a case such as camelCase or snake_case.

Jump to

Keyboard shortcuts

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