stringHelper

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64UrlDecode

func Base64UrlDecode(input string) (string, error)

Base64UrlDecode 解码 URL 和文件名安全的 Base64 编码字符串

func Base64UrlEncode

func Base64UrlEncode(input string) string

Base64UrlEncode 对字符串进行 URL 和文件名安全的 Base64 编码

func Basename

func Basename(path, suffix string) string

Basename 返回路径的最后一个名字组件

func ByteLength

func ByteLength(s string) int

ByteLength 返回给定字符串的字节数

func ByteSubstr

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

ByteSubstr 返回从 start 开始、长度为 length 的子字符串

func CountWords

func CountWords(s string) int

CountWords 计算字符串中的单词数

func Dirname

func Dirname(path string) string

Dirname 返回父目录的路径

func EndsWith

func EndsWith(s, suffix string, caseSensitive bool) bool

EndsWith 检查字符串是否以指定的子字符串结尾

func Explode

func Explode(s, delimiter string, trim bool, skipEmpty bool) []string

Explode 按分隔符分割字符串,选项修剪值并跳过空值

func FloatToString

func FloatToString(number float64) string

FloatToString 安全地将浮点数转换为字符串

func MatchWildcard

func MatchWildcard(pattern, s string, caseSensitive bool) bool

MatchWildcard 检查字符串是否匹配给定的通配符模式

func MbUcfirst

func MbUcfirst(s, encoding string) string

MbUcfirst 将字符串的第一个字符大写(支持多字节)

func MbUcwords

func MbUcwords(s, encoding string) string

MbUcwords 将字符串中的每个单词的第一个字符大写(支持多字节)

func NormalizeNumber

func NormalizeNumber(value interface{}) string

NormalizeNumber 将数字字符串中的逗号替换为点

func StartsWith

func StartsWith(s, prefix string, caseSensitive bool) bool

StartsWith 检查字符串是否以指定的子字符串开头

func Truncate

func Truncate(s string, length int, suffix string) string

Truncate 将字符串截断为指定的字符数

func TruncateWords

func TruncateWords(s string, count int, suffix string) string

TruncateWords 将字符串截断为指定的单词数

Types

This section is empty.

Jump to

Keyboard shortcuts

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