str

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UTF8    = Charset("UTF-8")
	GB18030 = Charset("GB18030")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes struct {
}

func NewBytes

func NewBytes() *Bytes

func (*Bytes) ToStr

func (*Bytes) ToStr(b []byte) string

byte转字符串

func (*Bytes) ToStrByCharset

func (*Bytes) ToStrByCharset(byte []byte, charset Charset) (ret string)

byte转字符串指定字符集

type Charset

type Charset string

type Json

type Json struct {
}

func NewJson

func NewJson() *Json

func (*Json) MarshalIndentJSON

func (*Json) MarshalIndentJSON(v interface{}, prefix, indent string) ([]byte, error)

func (*Json) MarshalJSON

func (*Json) MarshalJSON(v interface{}) ([]byte, error)

func (*Json) UnmarshalJSON

func (*Json) UnmarshalJSON(data []byte, v interface{}) error

type Str

type Str struct {
}

func NewStr

func NewStr() *Str

func (*Str) Contains

func (*Str) Contains(str string, strs []string) bool

Contains determines whether the str is in the strs.

func (*Str) EncloseIgnoreCase

func (*Str) EncloseIgnoreCase(text, open, close string, searchStrs ...string) string

Enclose encloses search strings with open and close, case-insensitively.

func (*Str) PYSort

func (*Str) PYSort(strArr []string) []string

中文拼音排序

func (*Str) ReplaceEmpty

func (*Str) ReplaceEmpty(str string, rep ...string) string

字符串替换

func (*Str) ReplaceIgnoreCase

func (*Str) ReplaceIgnoreCase(text, searchStr, repl string) string

ReplaceIgnoreCase replace searchStr with repl in the text, case-insensitively.

func (*Str) ReplaceRegexpStrEmpty

func (*Str) ReplaceRegexpStrEmpty(str string, math ...string) string

字符串正则替换

func (*Str) ReplacesIgnoreCase

func (*Str) ReplacesIgnoreCase(text string, searchStrRepl ...string) string

ReplacesIgnoreCase replace searchStr-repl pairs in the text, case-insensitively.

func (*Str) SplitByNum

func (*Str) SplitByNum(txt string, length int) []string

字符串拆分,按字数

func (*Str) SubStr

func (*Str) SubStr(str string, length int) string

高效截取字符串

func (*Str) ToBytes

func (*Str) ToBytes(s string) []byte

字符串转byte

func (*Str) ToDateStr

func (obj *Str) ToDateStr(t string) (string, error)

时间戳字符串转日期字符串

func (*Str) ToFloat64

func (*Str) ToFloat64(s string) (float64, error)

字符串转float

func (*Str) ToInt

func (*Str) ToInt(s string) (int, error)

字符串转int

func (*Str) ToInt64

func (*Str) ToInt64(s string) (int64, error)

字符串转int64

func (*Str) ToTime

func (*Str) ToTime(s string) (time.Time, error)

日期字符串转时间对象

func (*Str) ToTimeStr

func (obj *Str) ToTimeStr(s string) (string, error)

int字符串转时间字符串

Jump to

Keyboard shortcuts

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