nameconv

package module
v0.0.0-...-7e86b2b Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 4 Imported by: 2

README

nameconv

nameconv is a package for converting strings between different naming conventions including camelCase, kebab-case, PascalCase and snake_case.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyString = errors.New("cannot parse empty string")
View Source
var ErrExpectedCamelCase = errors.New("expected camel case")
View Source
var ErrExpectedKebabCase = errors.New("expected kebab case")
View Source
var ErrExpectedPascalCase = errors.New("expected pascal case")
View Source
var ErrExpectedSnakeCase = errors.New("expected snake case")

Functions

func ConvertStringListToName

func ConvertStringListToName(list []string) english.Name

func ParseCamelCase

func ParseCamelCase(s string) (english.Name, error)

ParseCamelCase parses a camelCase name into a Name. If the name is not valid camelCase, an error is returned.

func ParseEnglish

func ParseEnglish(n string) (english.Name, error)

ParseEnglish parses names that use the English alphabet and spaces to separate words. If there is a non-letter character in the name, it will be ignored. If the name is empty, an error is returned.

func ParseKebabCase

func ParseKebabCase(s string) (english.Name, error)

ParseKebabCase parses a kebab-case string into a Name. It returns an error if the string is empty or not kebab-case.

func ParsePascalCase

func ParsePascalCase(s string) (english.Name, error)

ParsePascalCase parses a PascalCase name into a Name. If the name is not valid PascalCase, an error is returned.

func ParseSnakeCase

func ParseSnakeCase(s string) (english.Name, error)

ParseSnakeCase parses a snake_case string into a Name. If the string is not valid snake_case, an error is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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