strcase

package module
v0.0.0-...-ac2c85c Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: MIT Imports: 2 Imported by: 13

README

strcase

Godoc Reference Build Status Coverage Go Report Card

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

Example

s Function Result
AnyKind of string v5 ToSnake(s) any_kind_of_string_v5
AnyKind of string v5 ToSnakeUpper(s) ANY_KIND_OF_STRING_V5
AnyKind of string v5 ToKebab(s) any-kind-of-string-v5
AnyKind of string v5 ToKebabUpper(s) ANY-KIND-OF-STRING5-V5
AnyKind of string v5 ToDelimited(s, '.') any.kind.of.string.v5
AnyKind of string v5 ToDelimitedUpper(s, '.') ANY.KIND.OF.STRING.V5
AnyKind of string v5 ToCamel(s) AnyKindOfStringV5
mySQL ToCamel(s) MySql
AnyKind of string v5 ToCamelLower(s) anyKindOfStringV5
ID ToCamelLower(s) id
SQLMap ToCamelLower(s) sqlMap
TestCase ToCamelLower(s) fooBar
foo-bar ToCamelLower(s) fooBar
foo_bar ToCamelLower(s) fooBar

Documentation

Overview

Package strcase converts strings to various cases. See the conversion table below: | Function | Result | |-----------------------------------|----------------------| | `ToSnake(s)` | `any_kind_of_string_v5` | | `ToSnakeUpper(s)` | `ANY_KIND_OF_STRING_V5` | | `ToKebab(s)` | `any-kind-of-string-v5` | | `ToKebabUpper(s)` | `ANY-KIND-OF-STRING5-V5` | | `ToDelimited(s, '.')` | `any.kind.of.string.v5` | | `ToDelimitedUpper(s, '.')` | `ANY.KIND.OF.STRING.V5` | | `ToCamel(s)` | `AnyKindOfStringV5` | | `ToCamelLower(s)` | `anyKindOfStringV5` |

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Is029

func Is029(v int32) bool

Is029 tells v is 0-9

func IsA2Z

func IsA2Z(v int32) bool

IsA2Z tells v is A-Z

func Isa2z

func Isa2z(v int32) bool

Isa2z tells v is a-z

func ToCamel

func ToCamel(s string) string

ToCamel converts a string to CamelCase

func ToCamelLower

func ToCamelLower(s string) string

ToCamelLower converts a string to lowerCamelCase

func ToDelimited

func ToDelimited(s string, del uint8) string

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

func ToDelimitedScreaming

func ToDelimitedScreaming(s string, del uint8, screaming bool) string

ToDelimitedScreaming converts a string to SCREAMING.DELIMITED.SNAKE.CASE (in this case `del = '.'; screaming = true`) or delimited.snake.case (in this case `del = '.'; screaming = false`)

func ToDelimitedUpper

func ToDelimitedUpper(s string, del uint8) string

ToDelimitedUpper converts a string to SCREAMING.DELIMITED.SNAKE.CASE (in this case `del = '.'; screaming = true`) or delimited.snake.case (in this case `del = '.'; screaming = false`)

func ToKebab

func ToKebab(s string) string

ToKebab converts a string to kebab-case

func ToKebabUpper

func ToKebabUpper(s string) string

ToKebabUpper converts a string to SCREAMING-KEBAB-CASE

func ToSnake

func ToSnake(s string) string

ToSnake converts a string to snake_case

func ToSnakeUpper

func ToSnakeUpper(s string) string

ToSnakeUpper converts a string to SCREAMING_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