stringhelper

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty(str string, defval string) (result string)

IsEmpty 判断字符串是否为空,为空则返回默认值

func IsNum

func IsNum(s string) bool

IsNum 实现类似php的is_number

func MD5Encode added in v0.0.7

func MD5Encode(s string) string

MD5Encode 进行MD5处理

func StrContains

func StrContains(s []string, e string) bool

StrContains 判断字符串数组中,是否包含某一字符串

func StrStr

func StrStr(haystack, needle string, beforeNeedle bool) (result string, exist bool)

*

  • StrStr 实现php中的strstr,needle是否是haystack的子串,为空则返回空字符串和false
  • 如果beforeNeedle是true, result返回子串位置之前,否则返回子串位置之后

func Trim

func Trim(str string, characterMask ...string) string

* * Trim * * @param string * @param ...string 按字符处理 * * @return

func TrimLeft

func TrimLeft(str string, characterMask ...string) string

func TrimRight

func TrimRight(str string, characterMask ...string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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