stringcase

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

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

Go to latest
Published: Jan 31, 2015 License: MIT Imports: 3 Imported by: 8

README

go-stringcase

go-stringcase is a Go library that makes it so you can convert strings to different casing styles:

  • lower case
  • UPPER CASE
  • Title Case
  • camelCase
  • PascalCase
  • snake_case
  • CONST_CASE
  • property-case
  • Header-Case

Examples

s := stringcase.ToLowerCase("Hello world")
// hello world
s := stringcase.ToUpperCase("Hello world")
// HELLO WORLD
s := stringcase.ToTitleCase("Hello world")
// Hello World
s := stringcase.ToCamelCase("Hello world")
// helloWorld
s := stringcase.ToPascalCase("Hello world")
// HelloWorld
s := stringcase.ToSnakeCase("Hello world")
// hello_world
s := stringcase.ToConstCase("Hello world")
// HELLO_WORLD
s := stringcase.ToPropertyCase("Hello world")
// hello-world
s := stringcase.ToHeaderCase("Hello world")
// Hello-World

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-stringcase

GoDoc

Documentation

Overview

Package stringcase makes it so you can convert strings to different casing styles:

* lower case

* UPPER CASE

* Title Case

* camelCase

* PascalCase

* snake_case

* CONST_CASE

* property-case

* Header-Case

Samples

s := stringcase.ToLowerCase("Hello world")
// hello world

.

s := stringcase.ToUpperCase("Hello world")
// HELLO WORLD

.

s := stringcase.ToTitleCase("Hello world")
// Hello World

,

s := stringcase.ToCamelCase("Hello world")
// helloWorld

.

s := stringcase.ToPascalCase("Hello world")
// HelloWorld

.

s := stringcase.ToSnakeCase("Hello world")
// hello_world

.

s := stringcase.ToConstCase("Hello world")
// HELLO_WORLD

.

s := stringcase.ToPropertyCase("Hello world")
// hello-world

.

s := stringcase.ToHeaderCase("Hello world")
// Hello-World

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToCamelCase

func ToCamelCase(s string) string

ToCamelCase converts the string to 'camelCase' and returns it.

func ToConstCase

func ToConstCase(s string) string

ToConstCase converts the string to 'CONST_CASE' and returns it.

func ToHeaderCase

func ToHeaderCase(s string) string

ToHeaderCase converts the string to 'Header-Case' and returns it.

func ToLowerCase

func ToLowerCase(s string) string

ToLowerCase converts the string to 'lower case' and returns it.

func ToPascalCase

func ToPascalCase(s string) string

ToPascalCase converts the string to 'PascalCase' and returns it.

func ToPropertyCase

func ToPropertyCase(s string) string

ToPropertyCase converts the string to 'property-case' and returns it.

func ToSnakeCase

func ToSnakeCase(s string) string

ToSnakeCase converts the string to 'snake_case' and returns it.

func ToTitleCase

func ToTitleCase(s string) string

ToTitleCase converts the string to 'Title Case' and returns it.

func ToUpperCase

func ToUpperCase(s string) string

ToUpperCase converts the string to 'UPPER CASE' and returns it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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