string

package
v0.0.0-...-512269d Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT 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 EncodePassword

func EncodePassword(rawPassword string) string

EncodePassword

func Equals

func Equals(a, b string) bool

Equals 比较两个字符串是否相等

func EqualsIgnoreCase

func EqualsIgnoreCase(a, b string) bool

EqualsIgnoreCase 比较两个字符串是否相等,忽略大小写

func GetRandomStr

func GetRandomStr(length int) string

GetRandomStr 生成随机字符串

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

IsNotEmpty checks if a string is not empty (""). Returns false if not empty, and false otherwise

func IsPalindrome

func IsPalindrome(s string) bool

IsPalindrome 判断字符串是否是回文(reports whether s reads the same forward and backward)

func IsPalindrome2

func IsPalindrome2(s string) bool

func IsPalindrome3

func IsPalindrome3(s string) bool

IsPalindrome3 判断字符串是否是回文(reports whether s reads the same forward and backward) 忽略大小写和非字母 Letter case is ignored, as are non-letters.

func LongestPalindromes

func LongestPalindromes(s string) string

LongestPalindromes Longest Palindromic Substring 最长回文子串 Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: "cbbd" Output: "bb"

func RuneAt

func RuneAt(s string, n int) rune

RuneAt 字符串第n个字符

func RuneFirstAt

func RuneFirstAt(s string) rune

RuneFirstAt 字符串第一个字符

func RuneLastAt

func RuneLastAt(s string) rune

RuneLastAt 字符串最后一个字符

func RuneLen

func RuneLen(s string) int

RuneLen 字符成长度

func StringsJoin

func StringsJoin(strs ...string) string

StringJoin 字符串拼接

func SubStr

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

SubStr 截取字符串 截取下标[start,end]的字符串

func SubStrLen

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

SubStrLen 截取下标start开始length长度的字符串

func ToCamel

func ToCamel(str string) string

ToCamel 下划线转驼峰

func ToCamelLower

func ToCamelLower(str string) string

ToCamelLower 下划线转驼峰,首字母小写

func ToCamelUpper

func ToCamelUpper(str string) string

ToCamelUpper 下划线转驼峰,首字母大写

func ToInt

func ToInt(str string) int

ToInt str to int, if error return 0 str: 字符串

func ToInt64

func ToInt64(str string) int64

func ToInt64ByDefault

func ToInt64ByDefault(str string, def int64) int64

ToInt64ByDefault 将字符串转换为int64 str: 字符串 def: 转化失败时候使用默认值

func ToIntByDefault

func ToIntByDefault(str string, def int) int

ToIntByDefault 将字符串转换为int str: 字符串 def: 转化失败时候使用默认值

func ToUnderline

func ToUnderline(str string) string

ToUnderline 驼峰转下划线

func ValidatePassword

func ValidatePassword(encodePassword string, inputPassword string) bool

ValidatePassword

Types

This section is empty.

Jump to

Keyboard shortcuts

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