stringcase

package
v0.166.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

README

stringcase

The stringcase package makes it simple to change the style of strings between formats like snake_case or PascalCase. This is handy when you want to maintain consistent style among map string keys that people need to read.

For instance, when you create logs, you may accidentally use different styles for keys. However, fixing these later may not be possible due to constraints in the logging system. As a precaution, you can format all the logging field keys to a particular style using the package, so that you are sure they all look the same.

Let's say you are working on a project where you need to generate code from a data model. The data model uses a naming convention of snake_case for variable names, but the code you need to generate requires PascalCase. Without the stringcase package, you would have to manually change each variable name, which can be tedious and error-prone. With the stringcase package, you can easily convert all variable names from snake_case to PascalCase in just a few lines of code. This can save you a lot of time and effort, and also reduce the likelihood of errors.

Documentation

Overview

Package stringcase makes it simple to change the style of strings between formats like snake_case or PascalCase.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCamel

func IsCamel(s string) bool

func IsKebab

func IsKebab(s string) bool

func IsPascal

func IsPascal(s string) bool

func IsScreamingSnake

func IsScreamingSnake(s string) bool

func IsSnake

func IsSnake(s string) bool

func ToCamel

func ToCamel(s string) string

func ToKebab

func ToKebab(s string) string

func ToPascal

func ToPascal(s string) string

func ToScreamingSnake

func ToScreamingSnake(s string) string

func ToSnake

func ToSnake(s string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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