ToolsString

package
v0.0.0-...-332b391 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAllSpace

func DeleteAllSpace(str string) string

DeleteAllSpace 利用正则表达式压缩字符串,去除空格或制表符

func GetGuid

func GetGuid() string

func RandInt

func RandInt(n int) int

func RandStringRunes

func RandStringRunes(n int, t StringType) string

func ReverseString

func ReverseString(s string) string

ReverseString 反转字符串

func StrToSlice

func StrToSlice(str string, split string) (result []string)

StrToSlice 将字符串按指定字符串打散成字符串切片

Types

type BuilderEx

type BuilderEx struct {
	// contains filtered or unexported fields
}

A BuilderEx is used to efficiently build a string using Write methods. It minimizes memory copying. The zero value is ready to use. Do not copy a non-zero BuilderEx.

func (*BuilderEx) Cap

func (b *BuilderEx) Cap() int

Cap returns the capacity of the builder's underlying byte slice. It is the total space allocated for the string being built and includes any bytes already written.

func (*BuilderEx) Clear

func (b *BuilderEx) Clear()

func (*BuilderEx) Grow

func (b *BuilderEx) Grow(n int)

Grow grows b's capacity, if necessary, to guarantee space for another n bytes. After Grow(n), at least n bytes can be written to b without another allocation. If n is negative, Grow panics.

func (*BuilderEx) Len

func (b *BuilderEx) Len() int

Len returns the number of accumulated bytes; b.Len() == len(b.String()).

func (*BuilderEx) Reset

func (b *BuilderEx) Reset()

Reset resets the BuilderEx to be empty.

func (*BuilderEx) String

func (b *BuilderEx) String() string

String returns the accumulated string.

func (*BuilderEx) Write

func (b *BuilderEx) Write(p []byte) (int, error)

Write appends the contents of p to b's buffer. Write always returns len(p), nil.

func (*BuilderEx) WriteByte

func (b *BuilderEx) WriteByte(c byte) error

WriteByte appends the byte c to b's buffer. The returned error is always nil.

func (*BuilderEx) WriteRune

func (b *BuilderEx) WriteRune(r rune) (int, error)

WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. It returns the length of r and a nil error.

func (*BuilderEx) WriteString

func (b *BuilderEx) WriteString(s string) (int, error)

WriteString appends the contents of s to b's buffer. It returns the length of s and a nil error.

type ObjectId

type ObjectId string

ObjectId is a unique ID identifying a BSON value. It must be exactly 12 bytes long. MongoDB objects by default have such a property set in their "_id" property.

http://www.mongodb.org/display/DOCS/Object+IDs

func NewObjectId

func NewObjectId() ObjectId

NewObjectId returns a new unique ObjectId. 4byte 时间, 3byte 机器ID 2byte pid 3byte 自增ID

func (ObjectId) Hex

func (id ObjectId) Hex() string

Hex returns a hex representation of the ObjectId. 返回16进制对应的字符串

type StringType

type StringType int
const (
	Letter StringType = iota
	Num
	All
)

Jump to

Keyboard shortcuts

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