caseconv

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 1 Imported by: 0

README

caseconv

caseconv is a library for converting strings to different cases.

Documentation

Full documentation can be found on pkg.go.dev.

Features

This library provides functionality for converting strings to the following cases:

  • camelCase
  • CONSTANT_CASE
  • kebab-case
  • PascalCase
  • snake_case
  • Start Case

Examples

A basic program which utilizes caseconv is as follows:

package main

import (
	"fmt"

	"github.com/devkevbot/caseconv"
)

func main() {
	fmt.Println("camel case ->", caseconv.ToCamelCase("hello world"))
	fmt.Println("constant case ->", caseconv.ToConstantCase("hello world"))
	fmt.Println("kebab case ->", caseconv.ToKebabCase("hello world"))
	fmt.Println("pascal case ->", caseconv.ToPascalCase("hello world"))
	fmt.Println("snake case ->", caseconv.ToSnakeCase("hello world"))
	fmt.Println("start case ->", caseconv.ToStartCase("hello world"))
}

Which prints the following:

camel case -> helloWorld
constant case -> HELLO_WORLD
kebab case -> hello-world   
pascal case -> HelloWorld   
snake case -> hello_world   
start case -> Hello World

Documentation

Overview

Package caseconv provides utility function to convert strings into different casings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToCamelCase

func ToCamelCase(s string) string

ToCamelCase returns a copy of the input string that is set to camelCase.

func ToConstantCase

func ToConstantCase(s string) string

ToConstantCase returns a copy of the input string that is set to CONSTANT_CASE.

func ToKebabCase

func ToKebabCase(s string) string

ToKebabCase returns a copy of the input string that is set to kebab-case.

func ToPascalCase

func ToPascalCase(s string) string

ToPascalCase returns a copy of the input string that is set to PascalCase.

func ToSnakeCase

func ToSnakeCase(s string) string

ToSnakeCase returns a copy of the input string that is set to snake_case.

func ToStartCase

func ToStartCase(s string) string

ToStartCase returns a copy of the input string that is set to Start Case.

Types

This section is empty.

Jump to

Keyboard shortcuts

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