Documentation
¶
Overview ¶
Package strutil provide some string,char,byte util functions
Index ¶
- Constants
- Variables
- func AddSlashes(s string) string
- func AfterFirst(s, sep string) string
- func AfterLast(s, sep string) string
- func AnyToString(val any, defaultAsErr bool) (s string, err error)
- func B32Decode(str string) string
- func B32Encode(str string) string
- func B64Decode(str string) string
- func B64DecodeBytes(str []byte) []byte
- func B64Encode(str string) string
- func B64EncodeBytes(src []byte) []byte
- func Base10Conv(src string, to int) string
- func BaseConv(src string, from, to int) string
- func BaseConvByTpl(src string, fromBase, toBase string) string
- func BeforeFirst(s, sep string) string
- func BeforeLast(s, sep string) string
- func BlankOr(val, defVal string) string
- func Bool(s string) (bool, error)
- func Byte2str(b []byte) string
- func Byte2string(b []byte) string
- func BytePos(s string, bt byte) int
- func Camel(s string, sep ...string) string
- func CamelCase(s string, sep ...string) string
- func Compare(s1, s2, op string) bool
- func ContainsAll(s string, subs []string) bool
- func ContainsByte(s string, c byte) bool
- func ContainsOne(s string, subs []string) bool
- func Cut(s, sep string) (before string, after string, found bool)
- func DateSN(prefix string) string
- func DateSNV2(prefix string, extBase ...int) string
- func DatetimeNo(prefix string) string
- func EscapeHTML(s string) string
- func EscapeJS(s string) string
- func FilterEmail(s string) string
- func FirstLine(output string) string
- func GenMd5(src any) string
- func GlobMatch(pattern, s string) bool
- func HasAllSubs(s string, subs []string) bool
- func HasEmpty(ss ...string) bool
- func HasOnePrefix(s string, prefixes []string) bool
- func HasOneSub(s string, subs []string) bool
- func HasOneSuffix(s string, suffixes []string) bool
- func HasPrefix(s string, prefix string) bool
- func HasSuffix(s string, suffix string) bool
- func HashPasswd(pwd, key string) string
- func IContains(s, sub string) bool
- func IEqual(s1, s2 string) bool
- func Implode(sep string, ss ...string) string
- func Indent(s, prefix string) string
- func IndentBytes(b, prefix []byte) []byte
- func Int(s string) (int, error)
- func Int64(s string) int64
- func Int64Or(s string, defVal int64) int64
- func Int64OrDefault(s string, defVal int64) int64
- func Int64OrErr(s string) (int64, error)
- func Int64OrPanic(s string) int64
- func IntOr(s string, defVal int) int
- func IntOrDefault(s string, defVal int) int
- func IntOrPanic(s string) int
- func Ints(s string, sep ...string) []int
- func IsAllEmpty(ss ...string) bool
- func IsAlphaNum(c uint8) bool
- func IsAlphabet(char uint8) bool
- func IsBlank(s string) bool
- func IsBlankBytes(bs []byte) bool
- func IsEmpty(s string) bool
- func IsEndOf(s, suffix string) bool
- func IsNotBlank(s string) bool
- func IsNumChar(c byte) bool
- func IsNumeric(s string) bool
- func IsSpace(c byte) bool
- func IsSpaceRune(r rune) bool
- func IsStartOf(s, prefix string) bool
- func IsStartsOf(s string, prefixes []string) bool
- func IsSymbol(r rune) bool
- func IsValidUtf8(s string) bool
- func IsVersion(s string) bool
- func Join(sep string, ss ...string) string
- func JoinAny(sep string, parts ...any) string
- func JoinList(sep string, ss []string) string
- func LTrim(s string, cutSet ...string) string
- func LikeMatch(pattern, s string) bool
- func Lower(s string) string
- func LowerFirst(s string) string
- func Lowercase(s string) string
- func Ltrim(s string, cutSet ...string) string
- func MD5(src any) string
- func MTimeBaseID(toBase int) string
- func MTimeHexID() string
- func MatchNodePath(pattern, s string, sep string) bool
- func Md5(src any) string
- func Md5Bytes(src any) []byte
- func MicroTimeHexID() string
- func MicroTimeID() string
- func MustBool(s string) bool
- func MustCut(s, sep string) (before string, after string)
- func MustInt(s string) int
- func MustInt64(s string) int64
- func MustString(val any) string
- func MustToTime(s string, layouts ...string) time.Time
- func MustUint(s string) uint64
- func NewReplacer(pairs map[string]string) *strings.Replacer
- func NoCaseEq(s, t string) bool
- func OrCond(cond bool, s1, s2 string) string
- func OrElse(s, orVal string) string
- func OrElseNilSafe(s *string, orVal string) string
- func OrHandle(s string, fn comdef.StringHandleFunc) string
- func PadBytes(bs []byte, pad byte, length int, pos PosFlag) []byte
- func PadBytesLeft(bs []byte, pad byte, length int) []byte
- func PadBytesRight(bs []byte, pad byte, length int) []byte
- func PadChars[T byte | rune](cs []T, pad T, length int, pos PosFlag) []T
- func PadLeft(s, pad string, length int) string
- func PadRight(s, pad string, length int) string
- func PadRunes(rs []rune, pad rune, length int, pos PosFlag) []rune
- func PadRunesLeft(rs []rune, pad rune, length int) []rune
- func PadRunesRight(rs []rune, pad rune, length int) []rune
- func Padding(s, pad string, length int, pos PosFlag) string
- func ParseSizeRange(expr string, opt *ParseSizeOpt) (min, max uint64, err error)
- func PathMatch(pattern, s string) bool
- func QuickMatch(pattern, s string) bool
- func QuietBool(s string) bool
- func QuietCut(s, sep string) (before string, after string)
- func QuietInt(s string) int
- func QuietInt64(s string) int64
- func QuietString(val any) string
- func Quote(s string) string
- func RTrim(s string, cutSet ...string) string
- func RandWithTpl(n int, letters string) string
- func RandomBytes(length int) ([]byte, error)
- func RandomChars(ln int) string
- func RandomCharsV2(ln int) string
- func RandomCharsV3(ln int) string
- func RandomString(length int) (string, error)
- func Repeat(s string, times int) string
- func RepeatBytes(char byte, times int) []byte
- func RepeatChars[T byte | rune](char T, times int) []T
- func RepeatRune(char rune, times int) []rune
- func Replaces(str string, pairs map[string]string) string
- func Resize(s string, length int, align PosFlag) string
- func Rtrim(s string, cutSet ...string) string
- func RuneCount(s string) int
- func RuneIsLower(c rune) bool
- func RuneIsUpper(c rune) bool
- func RuneIsWord(c rune) bool
- func RunePos(s string, ru rune) int
- func RuneWidth(r rune) int
- func RunesWidth(rs []rune) (w int)
- func SafeBool(s string) bool
- func SafeByteSize(sizeStr string) uint64
- func SafeInt(s string) int
- func SafeInt64(s string) int64
- func SafeString(in any) string
- func SafeUint(s string) uint64
- func ShortMd5(src any) string
- func Similarity(s, t string, rate float32) (float32, bool)
- func SimpleMatch(s string, keywords []string) bool
- func SnakeCase(s string, sep ...string) string
- func Split(s, sep string) (ss []string)
- func SplitByWhitespace(s string) []string
- func SplitInlineComment(val string, strict ...bool) (string, string)
- func SplitKV(s, sep string) (string, string)
- func SplitN(s, sep string, n int) (ss []string)
- func SplitNTrimmed(s, sep string, n int) (ss []string)
- func SplitNValid(s, sep string, n int) (ss []string)
- func SplitTrimmed(s, sep string) (ss []string)
- func SplitValid(s, sep string) (ss []string)
- func StrPos(s, sub string) int
- func String(val any) (string, error)
- func StringOr(val any, defVal string) string
- func StringOrDefault(val any, defVal string) string
- func StringOrErr(val any) (string, error)
- func StringOrPanic(val any) string
- func Strings(s string, sep ...string) []string
- func StripSlashes(s string) string
- func Substr(s string, pos, length int) string
- func SubstrCount(s, substr string, params ...uint64) (int, error)
- func TextSplit(s string, w int) []string
- func TextTruncate(s string, w int, tail string) string
- func TextWidth(s string) int
- func TextWrap(s string, w int) string
- func Title(s string) string
- func ToArray(s string, sep ...string) []string
- func ToBool(s string) (bool, error)
- func ToByteSize(sizeStr string) (uint64, error)
- func ToBytes(s string) (b []byte)
- func ToDuration(s string) (time.Duration, error)
- func ToInt(s string) (int, error)
- func ToInt64(s string) (int64, error)
- func ToIntSlice(s string, sep ...string) (ints []int, err error)
- func ToInts(s string, sep ...string) ([]int, error)
- func ToSlice(s string, sep ...string) []string
- func ToString(val any) (string, error)
- func ToStringWith(in any, optFns ...comfunc.ConvOptionFn) (string, error)
- func ToStrings(s string, sep ...string) []string
- func ToTime(s string, layouts ...string) (t time.Time, err error)
- func ToUint(s string) (uint64, error)
- func Trim(s string, cutSet ...string) string
- func TrimCut(s, sep string) (string, string)
- func TrimLeft(s string, cutSet ...string) string
- func TrimRight(s string, cutSet ...string) string
- func Truncate(s string, w int, tail string) string
- func URLDecode(s string) string
- func URLEncode(s string) string
- func Uint(s string) uint64
- func UintOr(s string, defVal uint64) uint64
- func UintOrDefault(s string, defVal uint64) uint64
- func UintOrErr(s string) (uint64, error)
- func UintOrPanic(s string) uint64
- func Unquote(s string) string
- func Upper(s string) string
- func UpperFirst(s string) string
- func UpperWord(s string) string
- func Uppercase(s string) string
- func Utf8Len(s string) int
- func Utf8Split(s string, w int) []string
- func Utf8Truncate(s string, w int, tail string) string
- func Utf8Width(s string) int
- func Utf8len(s string) int
- func Valid(ss ...string) string
- func VerifyPasswd(pwdMAC, pwd, key string) bool
- func VersionCompare(v1, v2, op string) bool
- func WidthWrap(s string, w int) string
- func WordWrap(s string, w int) string
- func WrapTag(s, tag string) string
- func ZeroOr[T ~string](val, defVal T) T
- type Buffer
- type Builder
- func (b *Builder) ResetGet() string
- func (b *Builder) Write(p []byte)
- func (b *Builder) WriteAny(v any)
- func (b *Builder) WriteAnys(vs ...any)
- func (b *Builder) WriteByteNE(c byte)
- func (b *Builder) WriteMulti(bs ...byte)
- func (b *Builder) WriteRune(r rune)
- func (b *Builder) WriteString(s string)
- func (b *Builder) WriteStrings(ss ...string)
- func (b *Builder) Writef(tpl string, vs ...any)
- func (b *Builder) Writeln(s string)
- type ByteChanPool
- type ParseSizeOpt
- type PosFlag
- type Runes
- type SimilarComparator
- type StrVal
- type Value
- func (s Value) Bool() bool
- func (s Value) Bytes() []byte
- func (s Value) HasPrefix(sub string) bool
- func (s Value) HasSuffix(sub string) bool
- func (s Value) Int() int
- func (s Value) Int64() int64
- func (s Value) IsBlank() bool
- func (s Value) IsEmpty() bool
- func (s Value) IsEndWith(sub string) bool
- func (s Value) IsStartWith(sub string) bool
- func (s Value) OrElse(or string) string
- func (s *Value) Set(val string) error
- func (s Value) Split(sep string) []string
- func (s Value) SplitN(sep string, n int) []string
- func (s Value) String() string
- func (s Value) Val() string
- func (s Value) WithTrimSpace() Value
Constants ¶
const ( Base10Chars = "0123456789" Base16Chars = "0123456789abcdef" Base32Chars = "0123456789abcdefghjkmnpqrstvwxyz" Base36Chars = "0123456789abcdefghijklmnopqrstuvwxyz" Base62Chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" Base64Chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/" )
const ( Numbers = "0123456789" HexChars = "0123456789abcdef" // base16 AlphaBet = "abcdefghijklmnopqrstuvwxyz" AlphaBet1 = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz" // AlphaNum chars, can use for base36 encode AlphaNum = "abcdefghijklmnopqrstuvwxyz0123456789" // AlphaNum2 chars, can use for base62 encode AlphaNum2 = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" AlphaNum3 = "0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz" )
some constants string chars
Variables ¶
var ( // ErrDateLayout error ErrDateLayout = errors.New("invalid date layout string") // ErrInvalidParam error ErrInvalidParam = errors.New("invalid input for parse time") )
var ( B32Std = base32.StdEncoding.WithPadding(base32.NoPadding) B32Hex = base32.HexEncoding.WithPadding(base32.NoPadding) )
base32 encoding with no padding
var ( UpWords = UpperWord LoFirst = LowerFirst UpFirst = UpperFirst Snake = SnakeCase )
methods aliases
var ( DefMinInt = 1000 DefMaxInt = 9999 )
global id:
https://github.com/rs/xid https://github.com/satori/go.uuid
var B64Std = base64.StdEncoding.WithPadding(base64.NoPadding)
B64Std base64 encoding with no padding
var Equal = strings.EqualFold
Equal check, alias of strings.EqualFold
var ErrInvalidSizeExpr = errors.New("invalid size expr")
ErrInvalidSizeExpr invalid size expression error
var InArray = HasOneSub
InArray alias of HasOneSub()
var StartsWith = strings.HasPrefix
StartsWith alias func for HasPrefix
var StartsWithAny = HasOneSuffix
StartsWithAny alias of the HasOnePrefix
Functions ¶
func AnyToString ¶
AnyToString convert any value to string.
For defaultAsErr:
- False will use fmt.Sprint convert unsupported type
- True will return error on convert fail.
func Base10Conv ¶
Base10Conv convert base 10 string to new base string.
func BaseConv ¶
BaseConv convert base string by from and to base.
Note: from and to base must be in [2, 64]
Usage:
BaseConv("123", 10, 16) // Output: "7b" BaseConv("7b", 16, 10) // Output: "123"
func BaseConvByTpl ¶
BaseConvByTpl convert base string by template.
Usage:
BaseConvert("123", Base62Chars, Base16Chars) // Output: "1e" BaseConvert("1e", Base16Chars, Base62Chars) // Output: "123"
func BeforeFirst ¶
BeforeFirst get substring before first sep.
func CamelCase ¶
CamelCase convert string to camel case.
Support:
"range_price" -> "rangePrice" "range price" -> "rangePrice" "range-price" -> "rangePrice"
func ContainsAll ¶
ContainsAll substr(s) in the given string. alias of HasAllSubs()
func ContainsOne ¶
ContainsOne substr(s) in the given string. alias of HasOneSub()
func DateSNV2 ¶
DateSNV2 generate date serial number.
- 2 < extBase <= 36
- return: PREFIX + yyyyMMddHHmmss + extBase(6bit micro + 5bit random number)
Example:
- prefix=P, extBase=16, return: P2023091414361354b4490(len=22)
- prefix=P, extBase=36, return: P202309141436131gw3jg(len=21)
func DatetimeNo ¶
DatetimeNo generate. can use for order-no.
- No prefix, return like: 2023041410484904074285478388(len: 28)
- With prefix, return like: prefix2023041410484904074285478388(len: 28 + len(prefix))
func GlobMatch ¶
GlobMatch check for a string match the pattern.
Difference with PathMatch() is: `*` can match any char, contain `/`.
func HasAllSubs ¶
HasAllSubs all substr in the given string.
func HasOnePrefix ¶
HasOnePrefix the string start withs one of the subs
func HasOneSuffix ¶
HasOneSuffix the string end withs one of the subs
func HashPasswd ¶
HashPasswd for quick hash an input password string
func Indent ¶
Indent inserts prefix at the beginning of each non-empty line of s. The end-of-line marker is NL.
func IndentBytes ¶
IndentBytes inserts prefix at the beginning of each non-empty line of b. The end-of-line marker is NL.
func Int64OrDefault ¶
Int64OrDefault convert string to int, return default value on fail
func Int64OrErr ¶
Int64OrErr convert string to int, return error on fail
func Int64OrPanic ¶
Int64OrPanic convert value to int, will panic on error
func IntOrDefault ¶
IntOrDefault convert string to int, return default value on fail
func IntOrPanic ¶
IntOrPanic convert value to int, will panic on error
func IsAlphaNum ¶
IsAlphaNum reports whether the byte is an ASCII letter, number, or underscore
func IsBlankBytes ¶
IsBlankBytes returns true if the given []byte is all space characters.
func IsNotBlank ¶
IsNotBlank returns true if the given string is not blank.
func IsSpaceRune ¶
IsSpaceRune returns true if the given rune is a space, otherwise false.
func IsStartsOf ¶
IsStartsOf alias of the HasOnePrefix
func MTimeBaseID ¶
MTimeBaseID micro time BASE id generate. toBase: 2 - 36
Examples:
- MTimeBaseID(16): 5b5f0588af1761ad3(len: 16-17)
- MTimeBaseID(36): gorntzvsa73mo(len: 13)
func MTimeHexID ¶
func MTimeHexID() string
MTimeHexID micro time hex id generate.
return like: 5b5f0588af1761ad3(len: 16-17)
func MatchNodePath ¶
MatchNodePath check for a string match the pattern.
Use on pattern:
- `*` match any to sep
- `**` match any to end. only allow at start or end on pattern.
Example:
strutil.MatchNodePath()
func MicroTimeHexID ¶
func MicroTimeHexID() string
MicroTimeHexID micro time hex id generate.
return like: 5b5f0588af1761ad3(len: 16-17)
func MicroTimeID ¶
func MicroTimeID() string
MicroTimeID generate.
- return like: 16074145697981929446(len: 20)
Conv Base:
mtId := MicroTimeID() // eg: 16935349145643425047 len: 20 b16id := Base10Conv(mtId, 16) // eg: eb067252154a9d17 len: 16 b32id := Base10Conv(mtId, 32) // eg: em1jia8akl78n len: 13 b36id := Base10Conv(mtId, 36) // eg: 3ko088phiuoev len: 13 b62id := Base10Conv(mtId, 62) // eg: kb24SKgsQ9V len: 11
func MustString ¶
MustString convert value to string, will panic on error
func MustToTime ¶
MustToTime convert date string to time.Time
func OrElseNilSafe ¶
OrElseNilSafe return default value on s is nil, otherwise return s
func OrHandle ¶
func OrHandle(s string, fn comdef.StringHandleFunc) string
OrHandle return fn(s) on s is not empty.
func PadBytesLeft ¶
PadBytesLeft a byte to want length
func PadBytesRight ¶
PadBytesRight a byte to want length
func PadRunesLeft ¶
PadRunesLeft a rune to want length
func PadRunesRight ¶
PadRunesRight a rune to want length
func ParseSizeRange ¶
func ParseSizeRange(expr string, opt *ParseSizeOpt) (min, max uint64, err error)
ParseSizeRange parse range size expression to min and max size.
Expression format:
"1KB~2MB" => 1KB to 2MB "-1KB" => <1KB "~1MB" => <1MB "< 1KB" => <1KB "1KB" => >1KB "1KB~" => >1KB ">1KB" => >1KB "+1KB" => >1KB
func PathMatch ¶
PathMatch check for a string match the pattern. alias of the path.Match()
TIP: `*` can match any char, not contain `/`.
func QuickMatch ¶
QuickMatch check for a string. pattern can be a sub string.
func QuietInt64 ¶
QuietInt64 convert string to int, will ignore error
func QuietString ¶
QuietString convert value to string, will ignore error. same as SafeString()
func RandWithTpl ¶
RandWithTpl generate random string with give template
func RandomChars ¶
RandomChars generate give length random chars at `a-z`
func RandomCharsV2 ¶
RandomCharsV2 generate give length random chars in `0-9a-z`
func RandomCharsV3 ¶
RandomCharsV3 generate give length random chars in `0-9a-zA-Z`
func RandomString ¶
RandomString generate.
Example:
// this will give us a 44 byte, base64 encoded output token, err := RandomString(16) // eg: "I7S4yFZddRMxQoudLZZ-eg"
func RepeatChars ¶
RepeatChars repeat a byte char.
func Replaces ¶
Replaces replace multi strings
pairs: {old1: new1, old2: new2, ...}
Can also use:
strings.NewReplacer("old1", "new1", "old2", "new2").Replace(str)
func RuneWidth ¶
RuneWidth of the rune.
Example:
RuneWidth('你') // 2 RuneWidth('a') // 1 RuneWidth('\n') // 0
func RunesWidth ¶
RunesWidth utf8 runes string width.
Examples:
str := "hi,你好" len(str) // 9 strutil.Utf8Width(str) // 7 len([]rune(str)) = utf8.RuneCountInString(s) // 5
func SafeByteSize ¶
SafeByteSize converts size string like 1GB/1g or 12mb/12M into an unsigned integer number of bytes
func SafeString ¶
SafeString convert value to string, will ignore error
func ShortMd5 ¶
ShortMd5 Generate a 16-bit md5 string. remove first 8 and last 8 bytes from 32-bit md5 string.
func SimpleMatch ¶
SimpleMatch all sub-string in the give text string.
Difference the ContainsAll:
- start with ^ for exclude contains check.
- end with $ for check end with keyword.
func SplitByWhitespace ¶
SplitByWhitespace Separate strings by whitespace characters (space, TAB, newline, etc.)
func SplitInlineComment ¶
SplitInlineComment for an inline text string.
func SplitNTrimmed ¶
SplitNTrimmed split string to slice. will trim space for each node, but not filter empty
func SplitNValid ¶
SplitNValid string to slice. will filter empty string node.
func SplitTrimmed ¶
SplitTrimmed split string to slice. will trim space for each node, but not filter empty
func SplitValid ¶
SplitValid string to slice. will trim each item and filter empty string node.
func StringOrDefault ¶
StringOrDefault convert any value to string, return default value on failed
func StringOrErr ¶
StringOrErr convert value to string, return error on failed
func StringOrPanic ¶
StringOrPanic convert value to string, will panic on error
func SubstrCount ¶
SubstrCount returns the number of times the substr substring occurs in the s string. Actually, it comes from strings.Count().
- s The string to search in
- substr The substring to search for
- params[0] The offset where to start counting.
- params[1] The maximum length after the specified offset to search for the substring.
func TextTruncate ¶
TextTruncate alias of the Utf8Truncate()
func ToByteSize ¶
ToByteSize converts size string like 1GB/1g or 12mb/12M into an unsigned integer number of bytes
func ToDuration ¶
ToDuration parses a duration string. such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
func ToStringWith ¶
func ToStringWith(in any, optFns ...comfunc.ConvOptionFn) (string, error)
ToStringWith try to convert value to string. can with some option func, more see comfunc.ConvOption.
func UintOrDefault ¶
UintOrDefault convert string to uint, return default value on fail
func UintOrPanic ¶
UintOrPanic convert value to uint, will panic on error
func Unquote ¶
Unquote remove start and end quotes by single-quote or double-quote
tip: strconv.Unquote cannot unquote single-quote
func Utf8Truncate ¶
Utf8Truncate a string with given width.
func VerifyPasswd ¶
VerifyPasswd for quick verify input password is valid
- pwdMAC from db or config, generated by EncryptPasswd()
func VersionCompare ¶
VersionCompare for two version string.
Types ¶
type Builder ¶
Builder struct
func (*Builder) WriteByteNE ¶
WriteByteNE write byte and no error report
func (*Builder) WriteMulti ¶
WriteMulti write multi byte at once.
func (*Builder) WriteStrings ¶
WriteStrings write multi string at once.
type ByteChanPool ¶
ByteChanPool struct
Usage:
bp := strutil.NewByteChanPool(500, 1024, 1024) buf:=bp.Get() defer bp.Put(buf) // use buf do something ...
func NewByteChanPool ¶
func NewByteChanPool(maxSize, width, capWidth int) *ByteChanPool
NewByteChanPool instance
type ParseSizeOpt ¶
type ParseSizeOpt struct { // OneAsMax if only one size value, use it as max size. default is false OneAsMax bool // SepChar is the separator char for time range string. default is '~' SepChar byte // KeywordFn is the function for parse keyword time string. KeywordFn func(string) (min, max uint64, err error) }
ParseSizeOpt parse size expression options
type Runes ¶
type Runes []rune
Runes data slice
type SimilarComparator ¶
type SimilarComparator struct {
// contains filtered or unexported fields
}
SimilarComparator definition
links:
https://github.com/mkideal/cli/blob/master/fuzzy.go
type Value ¶
type Value string
Value string
func (Value) WithTrimSpace ¶
WithTrimSpace string and return new
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package textscan Implemented a parser that quickly scans and analyzes text content.
|
Package textscan Implemented a parser that quickly scans and analyzes text content. |
Package textutil provide some extensions text handle util functions.
|
Package textutil provide some extensions text handle util functions. |