strs

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: MIT Imports: 1 Imported by: 5

README

strs

complementary string processing functions to strings stdlib.

Build Status Coverage Status Go Report Card Documentation

Install

$ go get github.com/lovego/strs

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelToSnake added in v0.0.2

func CamelToSnake(str string) string
Example
var inputs = []string{
	"XiaoMei", "xiaoMei", "HTTPStatus", "You123", "PriceP", "4sPrice", "Price4s", "goodHTTP",
	"ILoveGolangAndJSONSoMuch",
}
for i := range inputs {
	fmt.Println(CamelToSnake(inputs[i]))
}
Output:

xiao_mei
xiao_mei
http_status
you123
price_p
4s_price
price4s
good_http
i_love_golang_and_json_so_much

func FirstLetterToLower

func FirstLetterToLower(s string) string
Example
fmt.Println(FirstLetterToLower("abc"))
fmt.Println(FirstLetterToLower("Abc"))
Output:

abc
abc

func FirstLetterToUpper

func FirstLetterToUpper(s string) string
Example
fmt.Println(FirstLetterToUpper("Abc"))
fmt.Println(FirstLetterToUpper("abc"))
Output:

Abc
Abc

func SnakeToCamel added in v0.0.2

func SnakeToCamel(column string) string
Example
var inputs = []string{"xiao_mei", "http_status", "you123", "price_p"}
for i := range inputs {
	fmt.Println(SnakeToCamel(inputs[i]))
}
Output:

XiaoMei
HttpStatus
You123
PriceP

Types

This section is empty.

Jump to

Keyboard shortcuts

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