text

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 5 Imported by: 5

README

text

GoDoc

Text utilities for Go. Particularly useful for writing code generators.

Install

go get -u github.com/matthewmueller/text

API

Method From To Description
text.Space(str) hi - world hi world space case
text.Lower(str) TEST test lowercase
text.Upper(str) test TEST uppercase
text.Title(str) test Test Title Case
text.Camel(str) Test String testString camelCase
text.Pascal(str) test string TestString PascalCase
text.Snake(str) Test String Test_String snake_case
text.Slug(str) TestString1_2_3 Test-String1-2-3 slug-case
text.Dot(str) Test String Test.String dot.case
text.Path(str) Test String Test/String path/case
text.Short(str) Test String TS sc (short case)
text.Slim(str) My-Entrée MyEntrée slimcase
text.Singular(str) My-Entrées My-Entrée singular
text.Plural(str) My-Entrée My-Entrées plurals

Need another utility? Open a pull request!

Chainable strings

text.String wraps a string with chainable methods for use in templates or pipelines:

out := text.String("test string").Title().Slug().String()
// "Test-String"

Thanks

Authors

Documentation

Index

Constants

This section is empty.

Variables

Lower case is just an alias to strings.ToLower

Upper case is just an alias to strings.ToUpper

Functions

func Camel

func Camel(s string) string

Camel case (e.g. camelCase)

func Dot

func Dot(s string) string

Dot case (e.g. dot.case)

func Pascal

func Pascal(s string) string

Pascal case (e.g. PascalCase)

func Path

func Path(s string) string

Path case (e.g. path/case)

func Plural

func Plural(s string) string

Plural string (e.g. apples)

func Short

func Short(s string) string

Short case (e.g. sc)

func Singular

func Singular(s string) string

Singular string (e.g. apple)

func Slim

func Slim(s string) string

Slim case (e.g. Slimcase)

func Slug

func Slug(s string) string

Slug case (e.g. snake-case)

func Snake

func Snake(s string) string

Snake case (e.g. snake_case)

func Space

func Space(s string) string

Space case (e.g. Space case)

func Title

func Title(s string) string

Title case (e.g. Title Case)

Types

type String added in v0.1.0

type String string

String is a chainable string type. Useful for templates.

func (String) Camel added in v0.1.0

func (s String) Camel() String

Camel case (e.g. camelCase)

func (String) Dot added in v0.1.0

func (s String) Dot() String

Dot case (e.g. dot.case)

func (String) Pascal added in v0.1.0

func (s String) Pascal() String

Pascal case (e.g. PascalCase)

func (String) Path added in v0.1.0

func (s String) Path() String

Path case (e.g. path/case)

func (String) Plural added in v0.1.0

func (s String) Plural() String

Plural string (e.g. apples)

func (String) Short added in v0.1.0

func (s String) Short() String

Short case (e.g. sc)

func (String) Singular added in v0.1.0

func (s String) Singular() String

Singular string (e.g. apple)

func (String) Slim added in v0.1.0

func (s String) Slim() String

Slim case (e.g. Slimcase)

func (String) Slug added in v0.1.0

func (s String) Slug() String

Slug case (e.g. snake-case)

func (String) Snake added in v0.1.0

func (s String) Snake() String

Snake case (e.g. snake_case)

func (String) Space added in v0.1.0

func (s String) Space() String

Space case (e.g. Space case)

func (String) String added in v0.1.0

func (s String) String() string

String returns the string value of String.

func (String) Title added in v0.1.0

func (s String) Title() String

Title case (e.g. Title Case)

Jump to

Keyboard shortcuts

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