strs

package
v0.0.0-...-d31700d Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelToSnake

func CamelToSnake(str string) string

单词边界有两种 1. 非大写字符,且下一个是大写字符 2. 大写字符,且下一个是大写字符,且下下一个是非大写字符

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

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

func ThousandSep

func ThousandSep(value interface{}) string

func ThousandSplit

func ThousandSplit(number string) (result []string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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