stringutils

package
v0.0.0-...-13d1a28 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MulanPSL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VAR_KEY_FileName    = "FileName"
	VAR_KEY_Description = "Description"
	VAR_KEY_Author      = "Author"
	VAR_KEY_DATETIME    = "DATETIME"
)

Variables

This section is empty.

Functions

func Bool2Str

func Bool2Str(b bool) string

func BoolPtr2Str

func BoolPtr2Str(b *bool) string

func Camel2Case

func Camel2Case(name string) string

func Camel2CaseMultiField

func Camel2CaseMultiField(fields string) string

func Capitalize

func Capitalize(str string) string

func Case2Camel

func Case2Camel(name string) string

下划线写法转为驼峰写法

func CheckQueryParamUsing

func CheckQueryParamUsing(param *interface{}) (ok bool)

func IdTest

func IdTest()

func InjectIdGenerator

func InjectIdGenerator(s *IdGenerator)

func InjectStrTemplate

func InjectStrTemplate(s *StrTemplate)

func Int64ToLocalDateInt

func Int64ToLocalDateInt(sec int64) basemodel.LocalDateInt

func Int64ToLocalDateIntPtr

func Int64ToLocalDateIntPtr(sec int64) *basemodel.LocalDateInt

func Int64ToLocalTimeInt

func Int64ToLocalTimeInt(sec int64) basemodel.LocalTimeInt

func Int64ToLocalTimeIntPtr

func Int64ToLocalTimeIntPtr(sec int64) *basemodel.LocalTimeInt

func Int64ToLocalTimeIntUtcPtr

func Int64ToLocalTimeIntUtcPtr(sec int64) *basemodel.LocalTimeUTCInt

func Int64ToLocalTimeUtcInt

func Int64ToLocalTimeUtcInt(sec int64) basemodel.LocalTimeUTCInt

func Inttime2Str

func Inttime2Str(timestamp int64) string

func Ip4

func Ip4() string

LocalTimeInt

func Lcfirst

func Lcfirst(str string) string

首字母小写

func LcfirstCase2Camel

func LcfirstCase2Camel(str string) string

func List2Array

func List2Array(lst *list.List) []string

func List2string

func List2string(lst *list.List) string

func List2stringBy

func List2stringBy(lst *list.List, sep string) string

func LoadIdGenerator

func LoadIdGenerator() baseiface.ISingleton

func LoadStrTemplate

func LoadStrTemplate() baseiface.ISingleton

func LogList

func LogList(lst *list.List)

func Parse2JsonArray

func Parse2JsonArray(s string) []string

func ParseID

func ParseID(id int64) (timestamp time.Time, machineID int64, sequence int64)

ParseID 解析ID的组成部分

func ParseTemplateString

func ParseTemplateString(str string, vars interface{}) string

func PrintList

func PrintList(lst *list.List)

func QuateStr

func QuateStr(str string) string

func RandomString

func RandomString(n int) string

func ReplaceTextParentheses

func ReplaceTextParentheses(vars, textOriginal string) string

func ReverseASCII

func ReverseASCII(s string) string

func Str2BoolPtr

func Str2BoolPtr(s string) *bool

func Str2Float64

func Str2Float64(in string) float64

func Str2Int

func Str2Int(in string) int

func Str2Int32

func Str2Int32(in string) int32

func Str2Int64

func Str2Int64(in string) int64

timeNow := tNow.Format("2006-01-02 15:04:05")

func Strtime2Int

func Strtime2Int(datetime string) (timestamp int64)

func Strtime2Time

func Strtime2Time(datetime string) time.Time

func ToStringWith

func ToStringWith(in interface{}) (str string)

func Ucfirst

func Ucfirst(str string) string

首字母大写

func UcfirstCase2Camel

func UcfirstCase2Camel(str string) string

func UnzipStr

func UnzipStr(zipContent string) (originInfo []byte)

func ZipStr

func ZipStr(origin string) (content string)

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
}

内嵌bytes.Buffer,支持连写

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) Append

func (this *Buffer) Append(i interface{}) *Buffer

type IdGenerator

type IdGenerator struct {
	basedto.BaseEntitySingle
	// contains filtered or unexported fields
}

IdGenerator 唯一ID生成器

func DefaultIdGenerator

func DefaultIdGenerator() *IdGenerator

func FindBeanIdGenerator

func FindBeanIdGenerator() *IdGenerator

FindBeanIdGenerator

func NewIDGenerator

func NewIDGenerator(machineID int64) (*IdGenerator, error)

NewIDGenerator 创建新的生成器实例

func (*IdGenerator) GeneralMakeNo

func (g *IdGenerator) GeneralMakeNo(pre string) string

func (*IdGenerator) MakeBase10Digit

func (g *IdGenerator) MakeBase10Digit(pre string) string

func (*IdGenerator) Next

func (g *IdGenerator) Next() int64

Next 生成下一个唯一ID(线程安全)

func (*IdGenerator) NextBase10Digit

func (g *IdGenerator) NextBase10Digit() string

func (*IdGenerator) NextBase62

func (g *IdGenerator) NextBase62() string

NextBase62 生成Base62短ID(URL友好,11位字符)

func (*IdGenerator) NextString

func (g *IdGenerator) NextString() string

NextString 生成字符串格式的ID(更友好)

type StrTemplate

type StrTemplate struct {
	basedto.BaseEntity
	IfTest  bool   `json:"if_test"`
	FileKey string `json:"file_key"`

	Author      string
	Datetime    string
	FileName    string
	Description string

	Vars map[string]interface{}
}

func FindBeanStrTemplate

func FindBeanStrTemplate() *StrTemplate

FindBeanStrTemplate

func NewStrTemplate

func NewStrTemplate() *StrTemplate

func (*StrTemplate) Get

func (this *StrTemplate) Get(key string) string

func (*StrTemplate) ParseStr

func (this *StrTemplate) ParseStr(str string, vars interface{}) string

func (*StrTemplate) ParseTemplate

func (this *StrTemplate) ParseTemplate(bs string) string

func (*StrTemplate) ParseTemplateStr

func (this *StrTemplate) ParseTemplateStr(str string, vars interface{}) (string, error)

func (*StrTemplate) Put

func (this *StrTemplate) Put(key, value string) *StrTemplate

type UnixTime

type UnixTime timestamp.Timestamp

func (UnixTime) MarshalJSON

func (t UnixTime) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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