strcase

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultIfBlank

func DefaultIfBlank(str, def string) string

func Equals

func Equals(a, b string) bool

func EqualsIgnoreCase

func EqualsIgnoreCase(a, b string) bool

func GetHtmlText

func GetHtmlText(html string) string

GetHtmlText 获取html文本

func GetSummary

func GetSummary(s string, length int) string

GetSummary 获取summary

func IsAnyBlank

func IsAnyBlank(strs ...string) bool

func IsBlank

func IsBlank(str string) bool

IsBlank checks if a string is whitespace or empty (""). Observe the following behavior:

goutils.IsBlank("")        = true
goutils.IsBlank(" ")       = true
goutils.IsBlank("bob")     = false
goutils.IsBlank("  bob  ") = false

Parameter:

str - the string to check

Returns:

true - if the string is whitespace or empty ("")

func IsEmpty

func IsEmpty(str string) bool

IsEmpty checks if a string is empty (""). Returns true if empty, and false otherwise.

func IsNotBlank

func IsNotBlank(str string) bool

func IsNotEmpty

func IsNotEmpty(str string) bool

func RuneLen

func RuneLen(s string) int

RuneLen 字符成长度

func Substr

func Substr(s string, start, length int) string

截取字符串

func ToCamel

func ToCamel(s string) string

Converts a string to CamelCase

func ToDelimited

func ToDelimited(s string, del uint8) string

Converts a string to delimited.snake.case (in this case `del = '.'`)

func ToInt added in v0.0.3

func ToInt(str string) int

ToInt str to int,如果转换失败,默认值为0 str 字符串

func ToInt64 added in v0.0.3

func ToInt64(str string) int64

ToInt64 str to int64,如果转换失败,默认值为0 str 字符串

func ToInt64ByDefault added in v0.0.3

func ToInt64ByDefault(str string, def int64) int64

ToInt64ByDefault str to int64 str 字符串 def 如果转换失败使用的默认值

func ToIntByDefault added in v0.0.3

func ToIntByDefault(str string, def int) int

ToIntByDefault str to int str 字符串 def 如果转换失败使用的默认值

func ToKebab

func ToKebab(s string) string

Converts a string to kebab-case

func ToLowerCamel

func ToLowerCamel(s string) string

Converts a string to lowerCamelCase

func ToScreamingDelimited

func ToScreamingDelimited(s string, del uint8, screaming bool) string

Converts a string to SCREAMING.DELIMITED.SNAKE.CASE (in this case `del = '.'; screaming = true`) or delimited.snake.case (in this case `del = '.'; screaming = false`)

func ToScreamingKebab

func ToScreamingKebab(s string) string

Converts a string to SCREAMING-KEBAB-CASE

func ToScreamingSnake

func ToScreamingSnake(s string) string

Converts a string to SCREAMING_SNAKE_CASE

func ToSnake

func ToSnake(s string) string

Converts a string to snake_case

func UUID

func UUID() string

UUID

Types

This section is empty.

Jump to

Keyboard shortcuts

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