stringutil

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 12 Imported by: 16 modules, 14 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IgnoreCase = false

IgnoreCase for ignoring case when sorting in natural order

View Source
var NaturalOrder = false

NaturalOrder is the global variable for sorting String2ByteSlice

Functions

func CountOfString

func CountOfString(s []string) map[string]int

CountOfString returns the count of Key for a Key slice

func EscapeSymbols

func EscapeSymbols(s, symbols string) string

EscapeSymbols escape custom symbols

func ReverseStringSlice

func ReverseStringSlice(s []string) []string

ReverseStringSlice reverses StringSlice

func ReverseStringSliceInplace

func ReverseStringSliceInplace(s []string)

ReverseStringSliceInplace reverses StringSlice

func Split added in v0.3.0

func Split(slice string, letters string) []string

Split splits a byte slice by given letters

func Str2Bytes

func Str2Bytes(s string) []byte

Str2Bytes convert string to byte slice. Warning: it's unsafe!!!

func UnEscaper

func UnEscaper() func(s string) string

UnEscaper returns a function for unescaping string

Types

type ByValue

type ByValue struct {
	String2ByteSliceList
}

ByValue ...

func (ByValue) Less

func (list ByValue) Less(i, j int) bool

Less ...

type MultiKeyStringSlice

type MultiKeyStringSlice struct {
	SortTypes *[]SortType
	Value     []string
}

MultiKeyStringSlice sort [][]string by multiple keys

type MultiKeyStringSliceList

type MultiKeyStringSliceList []MultiKeyStringSlice

MultiKeyStringSliceList is slice of MultiKeyStringSlice

func (MultiKeyStringSliceList) Len

func (list MultiKeyStringSliceList) Len() int

func (MultiKeyStringSliceList) Less

func (list MultiKeyStringSliceList) Less(i, j int) bool

func (MultiKeyStringSliceList) Swap

func (list MultiKeyStringSliceList) Swap(i, j int)

type ReversedByValue

type ReversedByValue struct {
	String2ByteSliceList
}

ReversedByValue ...

func (ReversedByValue) Less

func (list ReversedByValue) Less(i, j int) bool

Less ...

type ReversedString2ByteSliceList

type ReversedString2ByteSliceList struct {
	String2ByteSliceList
}

ReversedString2ByteSliceList is reversed String2ByteSliceList

func (ReversedString2ByteSliceList) Less

func (list ReversedString2ByteSliceList) Less(i, j int) bool

Less ...

type ReversedStringCountList

type ReversedStringCountList struct {
	StringCountList
}

ReversedStringCountList is Reversed StringCountList

func (ReversedStringCountList) Less

func (b ReversedStringCountList) Less(i, j int) bool

Less is different from the Less of StringCountList

type SortType

type SortType struct {
	Index       int
	IgnoreCase  bool
	Natural     bool // natural order
	Number      bool
	Date        bool
	Length      bool // number of Unicode code points
	UserDefined bool
	Reverse     bool
	Levels      map[string]int
}

SortType defines the sort type

type String2ByteSlice

type String2ByteSlice struct {
	Key   string
	Value []byte
}

String2ByteSlice is for sortint of string-[]byte pairs

type String2ByteSliceList

type String2ByteSliceList []String2ByteSlice

String2ByteSliceList is list of string2ByteSlice

func (String2ByteSliceList) Len

func (list String2ByteSliceList) Len() int

func (String2ByteSliceList) Less

func (list String2ByteSliceList) Less(i, j int) bool

func (String2ByteSliceList) Swap

func (list String2ByteSliceList) Swap(i, j int)

type StringCount

type StringCount struct {
	Key   string
	Count int
}

StringCount is a struct store count of Key

type StringCountList

type StringCountList []StringCount

StringCountList is slice of Keycount

func SortCountOfString

func SortCountOfString(count map[string]int, reverse bool) StringCountList

SortCountOfString sorts count of Key

func (StringCountList) Len

func (b StringCountList) Len() int

func (StringCountList) Less

func (b StringCountList) Less(i, j int) bool

func (StringCountList) Swap

func (b StringCountList) Swap(i, j int)

Jump to

Keyboard shortcuts

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