strcase

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 1 Imported by: 447

README

GH Actions codecov GoDoc

Go strcase

The package strcase converts between different kinds of naming formats such as camel case (CamelCase), snake case (snake_case) or kebab case (kebab-case). The package is designed to work only with strings consisting of standard ASCII letters. Unicode is currently not supported.

Versioning and stability

Although the master branch is supposed to remain always backward compatible, the repository contains version tags in order to support vendoring tools. The tag names follow semantic versioning conventions and have the following format v1.0.0. This package supports Go modules introduced with version 1.11.

Example

import "github.com/stoewer/go-strcase"

var snake = strcase.SnakeCase("CamelCase")

Dependencies

Build dependencies

  • none

Test dependencies

  • github.com/stretchr/testify

Run linters and unit tests

To run the static code analysis, linters and tests use the following commands:

golangci-lint run --config .golangci.yml ./...
go test ./...

Documentation

Overview

Package strcase converts between different kinds of naming formats such as camel case (CamelCase), snake case (snake_case) or kebab case (kebab-case). The package is designed to work only with strings consisting of standard ASCII letters. Unicode is currently not supported.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KebabCase

func KebabCase(s string) string

KebabCase converts a string into kebab case.

func LowerCamelCase

func LowerCamelCase(s string) string

LowerCamelCase converts a string into camel case starting with a lower case letter.

func SnakeCase

func SnakeCase(s string) string

SnakeCase converts a string into snake case.

func UpperCamelCase

func UpperCamelCase(s string) string

UpperCamelCase converts a string into camel case starting with a upper case letter.

func UpperKebabCase added in v1.2.0

func UpperKebabCase(s string) string

UpperKebabCase converts a string into kebab case with capital letters.

func UpperSnakeCase added in v1.2.0

func UpperSnakeCase(s string) string

UpperSnakeCase converts a string into snake case with capital letters.

Types

This section is empty.

Jump to

Keyboard shortcuts

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