anycase

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: MIT Imports: 2 Imported by: 1

README

anycase

Godoc Reference Build Status Coverage Go Report Card

anycase is a go package for converting string case to various cases (e.g. snake case or camel case) or kebab case) to see the full conversion table below.

Install

go get -u github.com/loopcontext/anycase

Example

s := "AnyKind of_string"
Function Result
ToSnake(s) any_kind_of_string
ToSnakeAndIgnore(s, '.') any_kind.of_string
ToSnakeUppercase(s) ANY_KIND_OF_STRING
ToKebab(s) any-kind-of-string
ToKebabUppercase(s) ANY-KIND-OF-STRING
ToCamel(s) AnyKindOfString
ToLowerCamel(s) anyKindOfString
ToDelimited(s, '.') any.kind.of.string
ToDelimitedUppercase(s, '.', ' ', true) ANY.KIND OF.STRING
ToDelimitedUppercase(s, '.', '', true) ANY.KIND.OF.STRING

Documentation

Overview

Package anycase converts strings to various cases. See the conversion table below: | Function | Result | | ----------------------------------------- | -------------------- | | `ToSnake(s)` | `any_kind_of_string` | | `ToSnakeAndIgnore(s, '.')` | `any_kind.of_string` | | `ToSnakeUppercase(s)` | `ANY_KIND_OF_STRING` | | `ToKebab(s)` | `any-kind-of-string` | | `ToKebabUppercase(s)` | `ANY-KIND-OF-STRING` | | `ToCamel(s)` | `AnyKindOfString` | | `ToLowerCamel(s)` | `anyKindOfString` | | `ToDelimited(s, '.')` | `any.kind.of.string` | | `ToDelimitedUppercase(s, '.', ' ', true)` | `ANY.KIND OF.STRING` | | `ToDelimitedUppercase(s, '.', ”, true)` | `ANY.KIND.OF.STRING` |

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToCamel

func ToCamel(s string) string

ToCamel converts a string to CamelCase

func ToDelimited

func ToDelimited(s string, delimiter uint8) string

ToDelimited converts a string to delimited.snake.case (in this case `delimiter = '.'`)

func ToDelimitedUppercase

func ToDelimitedUppercase(s string, delimiter uint8, ignore uint8, uppercase bool) string

ToDelimitedUppercase converts a string to UPPERCASE.DELIMITED.SNAKE.CASE (in this case `delimiter = '.'; uppercase = true`) or delimited.snake.case (in this case `delimiter = '.'; uppercase = false`)

func ToKebab

func ToKebab(s string) string

ToKebab converts a string to kebab-case

func ToKebabUppercase

func ToKebabUppercase(s string) string

ToKebabUppercase converts a string to UPPERCASE-KEBAB-CASE

func ToLowerCamel

func ToLowerCamel(s string) string

ToLowerCamel converts a string to lowerCamelCase

func ToSnake

func ToSnake(s string) string

ToSnake converts a string to snake_case

func ToSnakeAndIgnore

func ToSnakeAndIgnore(s string, ignore uint8) string

ToSnakeAndIgnore converts to snake_case and ignores the following characters arg

func ToSnakeUppercase

func ToSnakeUppercase(s string) string

ToSnakeUppercase converts a string to UPPERCASE_SNAKE_CASE

Types

This section is empty.

Jump to

Keyboard shortcuts

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