xstring

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: GPL-2.0, GPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

字符串常用函数封装,如转数字、截取、修建、替换、切割等.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToStr

func BytesToStr(b []byte) string

字节数组转字符串

func Contains

func Contains(str string, of string) bool

是否包含指定字符

func EndWith

func EndWith(str string, of string) bool

是否以指定字符结束

func Format

func Format(format string, args ...interface{}) string

字符串格式化

func IndexOf

func IndexOf(str string, of string) int

找到指定字符的索引

func Int64ToString

func Int64ToString(itr int64) string

int64转字符串

func IsEmpty

func IsEmpty(str string) bool

是否为空

func LastIndexOf

func LastIndexOf(str string, of string) int

找到指定字符的索引(后)

func Replace

func Replace(str string, from string, to string) string

替换所有指定字符

func Split

func Split(str string, sep string) []string

字符串分割

sep: 分割符

func StartWith

func StartWith(str string, of string) bool

是否以指定字符起始

func StrToBytes

func StrToBytes(s string) []byte

字符串转字节数组

func Sub

func Sub(str string, from int, to int) string

截取

func ToFixed

func ToFixed(float interface{}, fixed ...int) string

保留指定位数的小数(参数为float32或float64)(默认保留两位小数)

fixed: 指定小数点位数

func ToInt

func ToInt(str string) int

字符串转int

func ToString

func ToString(itr int) string

int转字符串

func Trim

func Trim(str 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