casee

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: MIT Imports: 3 Imported by: 98

README

casee

Build Status Coverage Status Go Report Card Godoc license

Golang liibrary for case convertion of string.

Usage

  1. go get -d github.com/pinzolo/casee.
  2. Add github.com/pinzolo/casee to import section in your go file.

Functions

Convert functions
  • ToSnakeCase
    Convert to snake_case style string.
  • ToChainCase
    Convert to chain-case style string.
  • ToCamelCase
    Convert to camelCase style string.
  • ToPascalCase
    Convert to PascalCase style string.
  • ToFlatCase
    Convert to flatcase style string.
  • ToUpperCase
    Convert to UPPER_CASE style string.
Check functions
  • IsSnakeCase
    Check argument string is snake_case.
  • IsChainCase
    Check argument string is chain-case.
  • IsCamelCase
    Check argument string is camelCase.
  • IsPascalCase
    Check argument string is PascalCase.
  • IsFlatCase
    Check argument string is flatcase.
  • IsUpperCase
    Check argument string is UPPER_CASE.

If first character is digit, IsCamelCase, IsPascalCase and IsFlatCase always returns false.
Because cannot judge upper or lower.

Documentation

Overview

Provide convert functions (string => snake_case, chain-case, camelCase, PascalCase).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCamelCase

func IsCamelCase(s string) bool

If argument is camelCase style string, return true. If first character is digit, always returns false

func IsChainCase

func IsChainCase(s string) bool

If argument is chain-case style string, return true.

func IsFlatCase

func IsFlatCase(s string) bool

If argument is flatcase style string, return true. If first character is digit, always returns false

func IsPascalCase

func IsPascalCase(s string) bool

If argument is PascalCase style string, return true. If first character is digit, always returns false

func IsSnakeCase

func IsSnakeCase(s string) bool

If argument is snake_case style string, return true.

func IsUpperCase

func IsUpperCase(s string) bool

If argument is UPPER_CASE style string, return true.

func ToCamelCase

func ToCamelCase(s string) string

Convert argument to camelCase style string If argument is empty, return itself

func ToChainCase

func ToChainCase(s string) string

Convert argument to chain-case style string. If argument is empty, return itself.

func ToFlatCase

func ToFlatCase(s string) string

Convert argument to flatcase style string If argument is empty, return itself

func ToPascalCase

func ToPascalCase(s string) string

Convert argument to PascalCase style string If argument is empty, return itself

func ToSnakeCase

func ToSnakeCase(s string) string

Convert argument to snake_case style string. If argument is empty, return itself.

func ToUpperCase

func ToUpperCase(s string) string

Convert argument to UPPER_CASE style string. If argument is empty, return itself.

Types

This section is empty.

Jump to

Keyboard shortcuts

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