stringutil

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CharLength added in v0.0.2

func CharLength(s string) int

CharLength 返回字符个数

func GBK2UTF8 added in v0.0.3

func GBK2UTF8(str []byte) (b []byte, err error)

GBK2UTF8 transform GBK bytes to UTF-8 bytes

func IsPalindrome added in v0.0.2

func IsPalindrome(word string) bool

IsPalindrome 判断一个单词是否回文单词 思路:第一个字符和倒数第一个字符比较是否相等,第二和倒数第二比较,依次比较 有一个不相同就不是回文,否则,则是

func MD5 added in v0.0.4

func MD5(b []byte) string

MD5 计算 md5 值

func MD5Str added in v0.0.4

func MD5Str(s ...string) string

MD5Str 计算多个字符拼接后的字符串的 md5 值

func PadLeft added in v0.0.2

func PadLeft(s string, width int, pad rune) string

PadLeft 使用指定字符 pad 从左侧填充补齐字符串 s 到 width 指定的字符长度 example: PadLeft("test", 7, '*') = `***test`

func PadRight added in v0.0.2

func PadRight(s string, width int, pad rune) string

PadRight 使用指定字符 pad 从右侧填充补齐字符串 s 到 width 指定的字符长度 example: PadRight("test", 7, '*') = `test***`

func Reverse added in v0.0.2

func Reverse(s string) string

Reverse returns its argument string reversed rune-wise left to right.

func SimpleSimplifyWhitespace added in v0.0.2

func SimpleSimplifyWhitespace(s string) string

SimpleSimplifyWhitespace 去掉 s 首尾空白字符,且将 s 中间出现的空白字符(包括换行、tab键、多个空格)用一个空格替换

func SimplifyWhitespace added in v0.0.2

func SimplifyWhitespace(s string) string

SimplifyWhitespace 去掉 s 首尾空白字符,且将 s 中间出现的空白字符(包括换行、tab键、多个空格)用一个空格替换 比 SimpleSimplifyWhitespace() 更高效

func SimplifyWhitespaceWithReg added in v0.0.2

func SimplifyWhitespaceWithReg(s string) string

SimplifyWhitespaceWithReg 使用正则替换 s 中间的空白字符为一个空格

func Snake2Camel

func Snake2Camel(s string, title bool) string

Snake2Camel 蛇形下划线格式转驼峰 若 title == true,转成大驼峰,即:"under_score" -> "UnderScore"; 否则 -> "underScore"

func ToString added in v0.0.3

func ToString(v interface{}) string

ToString convert v to string

func UTF82GBK added in v0.0.3

func UTF82GBK(str []byte) (b []byte, err error)

UTF82GBK transform UTF-8 bytes to GBK bytes

func UUID added in v0.0.4

func UUID() string

UUID 生成 uuid

Types

This section is empty.

Jump to

Keyboard shortcuts

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