Documentation ¶
Index ¶
- Constants
- func HMapOrdFromHMap[K comparable, V any](hmap HMap[K, V]) *hMapOrd[K, V]
- func HMapOrdFromMap[K comparable, V any](m map[K]V) *hMapOrd[K, V]
- func NewHMapOrd[K comparable, V any](size ...int) *hMapOrd[K, V]
- type HBytes
- func (hbs HBytes) Add(bs HBytes) HBytes
- func (hbs HBytes) AddPrefix(bs HBytes) HBytes
- func (hbs HBytes) Bytes() []byte
- func (hbs HBytes) Clone() HBytes
- func (hbs HBytes) Compare(bs HBytes) HInt
- func (hbs HBytes) Contains(bs HBytes) bool
- func (hbs HBytes) ContainsAny(chars HString) bool
- func (hbs HBytes) ContainsRune(r rune) bool
- func (hbs HBytes) Count(bs HBytes) int
- func (hbs HBytes) Empty() bool
- func (hbs HBytes) Eq(bs HBytes) bool
- func (hbs HBytes) Gt(bs HBytes) bool
- func (hbs HBytes) HString() HString
- func (hbs HBytes) Hash() bhash
- func (hbs HBytes) Len() int
- func (hbs HBytes) LenRunes() int
- func (hbs HBytes) Lt(bs HBytes) bool
- func (hbs HBytes) Map(fn func(rune) rune) HBytes
- func (hbs HBytes) Ne(bs HBytes) bool
- func (hbs HBytes) NormalizeNFC() HBytes
- func (hbs HBytes) NotEmpty() bool
- func (hbs HBytes) Reader() *bytes.Reader
- func (hbs HBytes) Repeat(count int) HBytes
- func (hbs HBytes) Replace(oldB, newB HBytes, n int) HBytes
- func (hbs HBytes) ReplaceAll(oldB, newB HBytes) HBytes
- func (hbs HBytes) Reverse() HBytes
- func (hbs HBytes) Runes() []rune
- func (hbs HBytes) Split(sep ...HBytes) HSlice[HBytes]
- func (hbs HBytes) String() string
- func (hbs HBytes) ToLower() HBytes
- func (hbs HBytes) ToTitle() HBytes
- func (hbs HBytes) ToUpper() HBytes
- func (hbs HBytes) Trim(cutset HString) HBytes
- func (hbs HBytes) TrimLeft(cutset HString) HBytes
- func (hbs HBytes) TrimPrefix(cutset HBytes) HBytes
- func (hbs HBytes) TrimRight(cutset HString) HBytes
- func (hbs HBytes) TrimSpace() HBytes
- func (hbs HBytes) TrimSuffix(cutset HBytes) HBytes
- type HDir
- func (hd *HDir) CopyDir(dest HString) *HDir
- func (hd HDir) Error() error
- func (hd HDir) Exist() bool
- func (hd *HDir) Glob() []*HFile
- func (hd HDir) HString() HString
- func (hd *HDir) Join(elem ...HString) HString
- func (hd *HDir) Mkdir(mode ...os.FileMode) *HDir
- func (hd *HDir) MkdirAll(mode ...os.FileMode) *HDir
- func (hd *HDir) Path() HString
- func (hd *HDir) ReadDir() []*HFile
- func (hd *HDir) Rename(newpath HString) *HDir
- func (hd *HDir) SetPath(path HString) *HDir
- type HFile
- func (hf *HFile) Append(content HString, mode ...os.FileMode) *HFile
- func (hf *HFile) Chmod(mode os.FileMode) *HFile
- func (hf *HFile) Chown(uid, gid int) *HFile
- func (hf *HFile) Close()
- func (hf *HFile) Copy(dest HString, mode ...os.FileMode) *HFile
- func (hf HFile) Error() error
- func (hf HFile) Exist() bool
- func (hf HFile) Ext() HString
- func (hf HFile) File() *os.File
- func (hf HFile) HDir() *HDir
- func (hf HFile) IsDir() bool
- func (hf *HFile) Iterator() *hfiter
- func (hf *HFile) MimeType() HString
- func (hf HFile) ModTime() time.Time
- func (hf HFile) Mode() fs.FileMode
- func (hf HFile) Name() string
- func (hf HFile) Path() HString
- func (hf *HFile) Read() HString
- func (hf HFile) ReadLines() HSlice[HString]
- func (hf *HFile) Remove()
- func (hf *HFile) Rename(newpath HString) *HFile
- func (hf *HFile) SeekToLine(position int64, linesRead int) (int64, HString)
- func (hf HFile) Size() int64
- func (hf HFile) Split() (*HDir, *HFile)
- func (hf *HFile) TempFile(args ...HString) *HFile
- func (hf *HFile) Write(content HString, mode ...os.FileMode) *HFile
- type HFloat
- func (hf HFloat) Abs() HFloat
- func (hf HFloat) Add(b HFloat) HFloat
- func (hf HFloat) BigFloat() *big.Float
- func (hf HFloat) Bytes() []byte
- func (hf HFloat) Compare(b HFloat) HInt
- func (hf HFloat) Div(b HFloat) HFloat
- func (hf HFloat) Eq(b HFloat) bool
- func (hf HFloat) Float() float64
- func (hf HFloat) Gt(b HFloat) bool
- func (hf HFloat) HInt() HInt
- func (hf HFloat) HString() HString
- func (hf HFloat) Hash() fhash
- func (hf HFloat) Lt(b HFloat) bool
- func (hf HFloat) Mul(b HFloat) HFloat
- func (hf HFloat) Ne(b HFloat) bool
- func (hf HFloat) Round() HInt
- func (hf HFloat) RoundDecimal(precision int) HFloat
- func (hf HFloat) Sub(b HFloat) HFloat
- func (hf HFloat) UInt64() uint64
- type HInt
- func (hi HInt) Add(b HInt) HInt
- func (hi HInt) Bytes() []byte
- func (hi HInt) Div(b HInt) HInt
- func (hi HInt) Eq(b HInt) bool
- func (hi HInt) Gt(b HInt) bool
- func (hi HInt) Gte(b HInt) bool
- func (hi HInt) HFloat() HFloat
- func (hi HInt) HString() HString
- func (hi HInt) Hash() ihash
- func (hi HInt) Int() int
- func (hi HInt) Int16() int16
- func (hi HInt) Int32() int32
- func (hi HInt) Int64() int64
- func (hi HInt) Int8() int8
- func (hi HInt) IsNegative() bool
- func (hi HInt) IsPositive() bool
- func (hi HInt) Lt(b HInt) bool
- func (hi HInt) Lte(b HInt) bool
- func (hi HInt) Max(b HInt) HInt
- func (hi HInt) Min(b HInt) HInt
- func (hi HInt) Mul(b HInt) HInt
- func (hi HInt) Ne(b HInt) bool
- func (hi HInt) Random() HInt
- func (HInt) RandomRange(min, max HInt) HInt
- func (hi HInt) Sub(b HInt) HInt
- func (hi HInt) ToBinary() HString
- func (hi HInt) ToHex() HString
- func (hi HInt) ToOctal() HString
- func (hi HInt) UInt() uint
- func (hi HInt) UInt16() uint16
- func (hi HInt) UInt32() uint32
- func (hi HInt) UInt64() uint64
- func (hi HInt) UInt8() uint8
- type HMap
- func (hmap HMap[K, V]) Clear() HMap[K, V]
- func (hmap HMap[K, V]) Clone() HMap[K, V]
- func (hmap HMap[K, V]) Contains(key K) bool
- func (hmap HMap[K, V]) Copy(src HMap[K, V]) HMap[K, V]
- func (hmap HMap[K, V]) Delete(keys ...K) HMap[K, V]
- func (hmap HMap[K, V]) Empty() bool
- func (hmap HMap[K, V]) Eq(other HMap[K, V]) bool
- func (hmap HMap[K, V]) Filter(fn func(K, V) bool) HMap[K, V]
- func (hmap HMap[K, V]) FilterParallel(fn func(K, V) bool) HMap[K, V]
- func (hmap HMap[K, V]) ForEach(fn func(K, V))
- func (hmap HMap[K, V]) Get(k K) V
- func (hmap HMap[K, V]) GetOrDefault(key K, defaultValue V) V
- func (hmap HMap[K, V]) Invert() HMap[any, K]
- func (hmap HMap[K, V]) Keys() HSlice[K]
- func (hmap HMap[K, V]) Len() int
- func (hmap HMap[K, V]) Map(fn func(K, V) (K, V)) HMap[K, V]
- func (hmap HMap[K, V]) MapParallel(fn func(K, V) (K, V)) HMap[K, V]
- func (hmap HMap[K, V]) Ne(other HMap[K, V]) bool
- func (hmap HMap[K, V]) NotEmpty() bool
- func (hmap HMap[K, V]) Set(k K, v V) HMap[K, V]
- func (hmap HMap[K, V]) String() string
- func (hmap HMap[K, V]) ToMap() map[K]V
- func (hmap HMap[K, V]) Values() HSlice[V]
- type HSlice
- func (hsl HSlice[T]) AddUnique(elems ...T) HSlice[T]
- func (hsl HSlice[T]) All(fn func(T) bool) bool
- func (hsl HSlice[T]) Any(fn func(T) bool) bool
- func (hsl HSlice[T]) Append(elems ...T) HSlice[T]
- func (hsl HSlice[T]) Chunks(size int) []HSlice[T]
- func (hsl HSlice[T]) Clone() HSlice[T]
- func (hsl HSlice[T]) Contains(val T) bool
- func (hsl HSlice[T]) Count(elem T) int
- func (hsl HSlice[T]) Counter() *hMapOrd[any, int]
- func (hsl HSlice[T]) Cut(start, end int) HSlice[T]
- func (hsl HSlice[T]) Delete(i int) HSlice[T]
- func (hsl HSlice[T]) Difference(other HSlice[T]) HSlice[T]
- func (hsl HSlice[T]) Empty() bool
- func (hsl HSlice[T]) Enumerate() HMap[int, T]
- func (hsl HSlice[T]) Eq(other HSlice[T]) bool
- func (hsl HSlice[T]) Fill(val T) HSlice[T]
- func (hsl HSlice[T]) Filter(fn func(T) bool) HSlice[T]
- func (hsl HSlice[T]) FilterParallel(fn func(T) bool) HSlice[T]
- func (hsl HSlice[T]) FilterZeroValues() HSlice[T]
- func (hsl HSlice[T]) Flatten() HSlice[any]
- func (hsl HSlice[T]) ForEach(fn func(T))
- func (hsl HSlice[T]) Get(index int) T
- func (hsl HSlice[T]) Index(val T) int
- func (hsl HSlice[T]) Insert(index int, values ...T) HSlice[T]
- func (hsl HSlice[T]) Intersection(other HSlice[T]) HSlice[T]
- func (hsl HSlice[T]) Join(sep ...T) HString
- func (hsl HSlice[T]) Last() T
- func (hsl HSlice[T]) LastIndex() int
- func (hsl HSlice[T]) Len() int
- func (hsl HSlice[T]) Map(fn func(T) T) HSlice[T]
- func (hsl HSlice[T]) MapParallel(fn func(T) T) HSlice[T]
- func (hsl HSlice[T]) Max() T
- func (hsl HSlice[T]) Min() T
- func (hsl HSlice[T]) Ne(other HSlice[T]) bool
- func (hsl HSlice[T]) NotEmpty() bool
- func (hsl HSlice[T]) Permutations() []HSlice[T]
- func (hsl HSlice[T]) Pop() (T, HSlice[T])
- func (hsl HSlice[T]) Random() T
- func (hsl HSlice[T]) RandomSample(sequence int) HSlice[T]
- func (hsl HSlice[T]) Range(start, end int) HSlice[T]
- func (hsl HSlice[T]) Reduce(fn func(acc, val T) T, initial T) T
- func (hsl HSlice[T]) ReduceParallel(fn func(T, T) T, initial T) T
- func (hsl HSlice[T]) Reverse() HSlice[T]
- func (hsl HSlice[T]) Set(i int, val T)
- func (hsl HSlice[T]) Shuffle() HSlice[T]
- func (hsl HSlice[T]) SortBy(f func(i, j int) bool) HSlice[T]
- func (hsl HSlice[T]) String() string
- func (hsl HSlice[T]) Swap(i, j int) HSlice[T]
- func (hsl HSlice[T]) SymmetricDifference(other HSlice[T]) HSlice[T]
- func (hsl HSlice[T]) ToHMapHashed() HMap[HString, T]
- func (hsl HSlice[T]) ToSlice() []T
- func (hsl HSlice[T]) ToStringSlice() []string
- func (hsl HSlice[T]) Union(other HSlice[T]) HSlice[T]
- func (hsl HSlice[T]) Unique() HSlice[T]
- func (hsl HSlice[T]) Zip(slices ...HSlice[T]) []HSlice[T]
- type HString
- func (hs HString) Add(hstr HString) HString
- func (hs HString) AddPrefix(hstr HString) HString
- func (hs HString) Bytes() []byte
- func (hs HString) Chunks(size int) HSlice[HString]
- func (hs HString) Compare(hstr HString) HInt
- func (hs HString) Contains(substr HString) bool
- func (hs HString) ContainsAny(chars HString) bool
- func (hs HString) ContainsRune(r rune) bool
- func (hs HString) Count(substr HString) int
- func (hs HString) Cut(start, end HString) HString
- func (hs HString) Decode() dec
- func (hs HString) Empty() bool
- func (hs HString) Encode() enc
- func (hs HString) Eq(hstr HString) bool
- func (hs HString) Fields() HSlice[HString]
- func (hs HString) Gt(hstr HString) bool
- func (hs HString) HBytes() HBytes
- func (hs HString) HFloat() HFloat
- func (hs HString) HInt() HInt
- func (hs HString) HasPrefix(prefix HString) bool
- func (hs HString) HasSuffix(suffix HString) bool
- func (hs HString) Hash() shash
- func (hs HString) Index(substr HString) int
- func (hs HString) IndexRune(r rune) int
- func (hs HString) IsDigit() bool
- func (hs HString) Len() int
- func (hs HString) LenRunes() int
- func (hs HString) Lt(hstr HString) bool
- func (hs HString) Map(fn func(rune) rune) HString
- func (hs HString) Ne(hstr HString) bool
- func (hs HString) NormalizeNFC() HString
- func (hs HString) NotEmpty() bool
- func (HString) Random(count int) HString
- func (hs HString) Reader() *strings.Reader
- func (hs HString) Repeat(count int) HString
- func (hs HString) Replace(oldS, newS HString, n int) HString
- func (hs HString) ReplaceAll(oldS, newS HString) HString
- func (hs HString) Reverse() HString
- func (hs HString) Runes() []rune
- func (hs HString) Similarity(hstr HString) HFloat
- func (hs HString) Split(sep ...HString) HSlice[HString]
- func (hs HString) String() string
- func (hs HString) ToLower() HString
- func (hs HString) ToTitle() HString
- func (hs HString) ToUpper() HString
- func (hs HString) Trim(cutset HString) HString
- func (hs HString) TrimLeft(cutset HString) HString
- func (hs HString) TrimPrefix(cutset HString) HString
- func (hs HString) TrimRight(cutset HString) HString
- func (hs HString) TrimSpace() HString
- func (hs HString) TrimSuffix(cutset HString) HString
Constants ¶
const ( ASCII_LETTERS = ASCII_LOWERCASE + ASCII_UPPERCASE ASCII_LOWERCASE = "abcdefghijklmnopqrstuvwxyz" ASCII_UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" DIGITS = "0123456789" HEXDIGITS = "0123456789abcdefABCDEF" OCTDIGITS = "01234567" PUNCTUATION = `!"#$%&'()*+,-./:;<=>?@[\]^{|}~` + "`" FileDefault os.FileMode = 0o644 DirDefault os.FileMode = 0o755 FullAccess os.FileMode = 0o777 )
Variables ¶
This section is empty.
Functions ¶
func HMapOrdFromHMap ¶
func HMapOrdFromHMap[K comparable, V any](hmap HMap[K, V]) *hMapOrd[K, V]
HMapOrdFromHMap converts a standard HMap to an ordered HMap.
func HMapOrdFromMap ¶
func HMapOrdFromMap[K comparable, V any](m map[K]V) *hMapOrd[K, V]
HMapOrdFromHMap converts a standard HMap to an ordered HMap.
func NewHMapOrd ¶
func NewHMapOrd[K comparable, V any](size ...int) *hMapOrd[K, V]
NewHMapOrd creates a new ordered HMap with the specified size (if provided).
Types ¶
type HBytes ¶
type HBytes []byte
func NewHBytes ¶
NewHBytes creates a new HBytes value. Takes a variadic byte slice as input and returns an HBytes instance.
func (HBytes) Clone ¶
Clone creates a new HBytes instance with the same content as the current HBytes.
func (HBytes) ContainsAny ¶
ContainsAny checks if the given HBytes contains any characters from the input HString.
func (HBytes) ContainsRune ¶
ContainsRune checks if the HBytes contains the specified rune.
func (HBytes) Hash ¶
func (hbs HBytes) Hash() bhash
Hash returns a bhash struct wrapping the given HBytes.
func (HBytes) Map ¶
Map applies a function to each rune in the HBytes and returns the modified HBytes.
func (HBytes) NormalizeNFC ¶
NormalizeNFC returns a new HBytes with its Unicode characters normalized using the NFC form.
func (HBytes) Repeat ¶
Repeat returns a new HBytes consisting of the current HBytes repeated 'count' times.
func (HBytes) Replace ¶
Replace replaces the first 'n' occurrences of 'oldB' with 'newB' in the HBytes.
func (HBytes) ReplaceAll ¶
ReplaceAll replaces all occurrences of 'oldB' with 'newB' in the HBytes.
func (HBytes) TrimPrefix ¶
TrimPrefix trims the specified HBytes prefix from the HBytes.
func (HBytes) TrimSpace ¶
TrimSpace trims white space characters from the beginning and end of the HBytes.
func (HBytes) TrimSuffix ¶
TrimSuffix trims the specified HBytes suffix from the HBytes.
type HDir ¶
type HDir struct {
// contains filtered or unexported fields
}
func (*HDir) CopyDir ¶
CopyDir copies the contents of the current directory to the destination directory.
func (*HDir) Glob ¶
Glob matches files in the current directory using the path pattern and returns a slice of HFile instances.
func (*HDir) Join ¶
Join joins the current directory path with the given path elements, returning the joined path.
func (*HDir) MkdirAll ¶
MkdirAll creates all directories along the given path, with the specified mode (optional).
func (*HDir) ReadDir ¶
ReadDir reads the content of the current directory and returns a slice of HFile instances.
type HFile ¶
type HFile struct {
// contains filtered or unexported fields
}
func (*HFile) Append ¶
Append appends the given content to the file, with the specified mode (optional).
func (*HFile) Close ¶
func (hf *HFile) Close()
Close closes the HFile's underlying file, if it is not already closed. If an error occurs during closing, it is stored in hf.err and can be checked by the Error() method.
func (*HFile) Copy ¶
Copy copies the file to the specified destination, with the specified mode (optional).
func (*HFile) Iterator ¶
func (hf *HFile) Iterator() *hfiter
Iterator returns a new hfiter instance that can be used to read the file line by line, word by word, rune by rune, or byte by byte.
func (*HFile) SeekToLine ¶
SeekToLine seeks to the specified position in the file and reads the specified number of lines from that position.
func (*HFile) TempFile ¶
TempFile creates a new temporary file in the given directory (if specified) and with the given pattern (if specified). If dir is the empty string, TempFile uses the default directory for temporary files, as returned by TempDir. If pattern includes a "*", the random string replaces the last "*".
type HFloat ¶
type HFloat float64
func (HFloat) Hash ¶
func (hf HFloat) Hash() fhash
Hash returns a fhash struct wrapping the given HFloat.
func (HFloat) Round ¶
Round rounds the HFloat to the nearest integer and returns the result as an HInt.
func (HFloat) RoundDecimal ¶
RoundDecimal rounds the HFloat value to the specified number of decimal places. It takes the number of decimal places (precision) as an argument and returns a new HFloat value rounded to that number of decimals.
type HInt ¶
type HInt int
func (HInt) IsNegative ¶
IsNegative checks if the HInt is negative.
func (HInt) IsPositive ¶
IsPositive checks if the HInt is positive.
func (HInt) RandomRange ¶
RandomRange returns a random HInt in the range [min, max].
type HMap ¶
type HMap[K comparable, V any] map[K]V
func HMapFromMap ¶
func HMapFromMap[K comparable, V any](m map[K]V) HMap[K, V]
HMapFromMap creates an HMap from a given Go map.
func HMapOf ¶
func HMapOf[K comparable, V any](entries ...any) HMap[K, V]
HMapOf creates an HMap from a list of alternating keys and values.
func NewHMap ¶
func NewHMap[K comparable, V any](size ...int) HMap[K, V]
NewHMap creates a new HMap of the specified size or an empty HMap if no size is provided.
func (HMap[K, V]) Clear ¶
func (hmap HMap[K, V]) Clear() HMap[K, V]
Clear removes all key-value pairs from the HMap.
func (HMap[K, V]) Clone ¶
func (hmap HMap[K, V]) Clone() HMap[K, V]
Clone creates a new HMap that is a copy of the original HMap.
func (HMap[K, V]) Contains ¶
func (hmap HMap[K, V]) Contains(key K) bool
Contains checks if the HMap contains the specified key.
func (HMap[K, V]) Copy ¶
func (hmap HMap[K, V]) Copy(src HMap[K, V]) HMap[K, V]
Copy copies the source HMap's key-value pairs to the target HMap.
func (HMap[K, V]) Delete ¶
func (hmap HMap[K, V]) Delete(keys ...K) HMap[K, V]
Delete removes the specified keys from the HMap.
func (HMap[K, V]) Eq ¶
func (hmap HMap[K, V]) Eq(other HMap[K, V]) bool
Eq checks if two HMaps are equal.
func (HMap[K, V]) Filter ¶
func (hmap HMap[K, V]) Filter(fn func(K, V) bool) HMap[K, V]
Filter filters the HMap based on a given function and returns a new HMap containing the matching key-value pairs.
func (HMap[K, V]) FilterParallel ¶
func (hmap HMap[K, V]) FilterParallel(fn func(K, V) bool) HMap[K, V]
TODO: написать тесты. FilterParallel filters the HMap based on a given function in parallel and returns a new HMap containing the matching key-value pairs.
func (HMap[K, V]) ForEach ¶
func (hmap HMap[K, V]) ForEach(fn func(K, V))
ForEach applies a function to each key-value pair in the HMap.
func (HMap[K, V]) Get ¶
func (hmap HMap[K, V]) Get(k K) V
Get retrieves the value associated with the given key.
func (HMap[K, V]) GetOrDefault ¶
func (hmap HMap[K, V]) GetOrDefault(key K, defaultValue V) V
GetOrDefault returns the value for a key. If the key does not exist, returns the default value instead.
func (HMap[K, V]) Invert ¶
func (hmap HMap[K, V]) Invert() HMap[any, K]
Invert inverts the keys and values of the HMap.
func (HMap[K, V]) Keys ¶
func (hmap HMap[K, V]) Keys() HSlice[K]
Keys returns a slice of the HMap's keys.
func (HMap[K, V]) Len ¶
func (hmap HMap[K, V]) Len() int
Len returns the number of key-value pairs in the HMap.
func (HMap[K, V]) Map ¶
func (hmap HMap[K, V]) Map(fn func(K, V) (K, V)) HMap[K, V]
Map applies a function to each key-value pair in the HMap and returns a new HMap with the results.
func (HMap[K, V]) MapParallel ¶
func (hmap HMap[K, V]) MapParallel(fn func(K, V) (K, V)) HMap[K, V]
MapParallel applies a function to each key-value pair in the HMap in parallel and returns a new HMap with the results.
func (HMap[K, V]) Ne ¶
func (hmap HMap[K, V]) Ne(other HMap[K, V]) bool
Ne checks if two HMaps are not equal.
func (HMap[K, V]) NotEmpty ¶
func (hmap HMap[K, V]) NotEmpty() bool
NotEmpty checks if the HMap is not empty.
func (HMap[K, V]) Set ¶
func (hmap HMap[K, V]) Set(k K, v V) HMap[K, V]
Set sets the value for the given key in the HMap.
func (HMap[K, V]) String ¶
func (hmap HMap[K, V]) String() string
String returns a string representation of the HMap.
type HSlice ¶
type HSlice[T any] []T
func NewHSlice ¶
NewHSlice creates a new generic slice of type T with the specified size. If no size is provided, it creates an empty slice.
func (HSlice[T]) AddUnique ¶
AddUnique appends unique elements from the provided arguments to the current slice.
func (HSlice[T]) All ¶
All returns true if all elements in the slice satisfy the provided condition.
func (HSlice[T]) Any ¶
Any returns true if any element in the slice satisfies the provided condition.
func (HSlice[T]) Append ¶
Append appends the provided elements to the slice and returns the modified slice.
func (HSlice[T]) Counter ¶
Counter returns an ordered map with the counts of each unique element in the slice.
func (HSlice[T]) Cut ¶
Cut returns a new slice that is the current slice with the elements between the specified start and end indices removed.
func (HSlice[T]) Delete ¶
Delete removes the element at the specified index from the slice and returns the modified slice.
func (HSlice[T]) Difference ¶
Difference returns the difference between the current slice and another slice, i.e., elements present in the current slice but not in the other slice.
func (HSlice[T]) Filter ¶
Filter returns a new slice containing elements that satisfy a given condition.
func (HSlice[T]) FilterParallel ¶
FilterParallel returns a new slice containing elements that satisfy a given condition, computed in parallel.
func (HSlice[T]) FilterZeroValues ¶
FilterZeroValues returns a new slice with all zero values removed.
func (HSlice[T]) Flatten ¶
Flatten flattens the nested slice structure into a single-level HSlice[any].
func (HSlice[T]) ForEach ¶
func (hsl HSlice[T]) ForEach(fn func(T))
ForEach applies a given function to each element in the slice.
func (HSlice[T]) Get ¶
Get returns the element at the given index, handling negative indices as counting from the end of the slice.
func (HSlice[T]) Index ¶
Index returns the index of the first occurrence of the specified value in the slice, or -1 if not found.
func (HSlice[T]) Insert ¶
Insert inserts values at the specified index in the slice and returns the resulting slice.
func (HSlice[T]) Intersection ¶
Intersection returns the intersection of the current slice and another slice, i.e., elements present in both slices.
func (HSlice[T]) Join ¶
Join joins the elements in the slice into a single HString, separated by the provided separator (if any).
func (HSlice[T]) Map ¶
Map returns a new slice by applying a given function to each element in the current slice.
func (HSlice[T]) MapParallel ¶
MapParallel applies a given function to each element in the slice in parallel and returns a new slice.
func (HSlice[T]) Max ¶
func (hsl HSlice[T]) Max() T
Max returns the maximum element in the slice, assuming elements are comparable.
func (HSlice[T]) Min ¶
func (hsl HSlice[T]) Min() T
Min returns the minimum element in the slice, assuming elements are comparable.
func (HSlice[T]) Permutations ¶
Permutations returns all possible permutations of the elements in the slice.
func (HSlice[T]) Pop ¶
Pop returns the last element of the slice and a new slice without the last element.
func (HSlice[T]) Random ¶
func (hsl HSlice[T]) Random() T
Random returns a random element from the slice.
func (HSlice[T]) RandomSample ¶
RandomSample returns a new slice containing a random sample of elements from the original slice.
func (HSlice[T]) Range ¶
Range returns a new slice containing elements from the current slice between the specified start and end indices.
func (HSlice[T]) Reduce ¶
func (hsl HSlice[T]) Reduce(fn func(acc, val T) T, initial T) T
Reduce reduces the slice to a single value using a given function and an initial value.
func (HSlice[T]) ReduceParallel ¶
func (hsl HSlice[T]) ReduceParallel(fn func(T, T) T, initial T) T
ReduceParallel reduces the slice to a single value using a given function and an initial value, computed in parallel.
func (HSlice[T]) SortBy ¶
SortBy sorts the elements in the slice using the provided comparison function.
func (HSlice[T]) Swap ¶
Swap swaps the elements at the specified indices in the slice and returns the modified slice.
func (HSlice[T]) SymmetricDifference ¶
SymmetricDifference returns the symmetric difference between the current slice and another slice, i.e., elements present in either the current slice or the other slice but not in both.
func (HSlice[T]) ToHMapHashed ¶
ToHMapHashed returns a map with the hashed version of each element as the key.
func (HSlice[T]) ToSlice ¶
func (hsl HSlice[T]) ToSlice() []T
ToSlice returns a new slice with the same elements as the HSlice[T].
func (HSlice[T]) ToStringSlice ¶
ToStringSlice converts the slice into a slice of strings.
func (HSlice[T]) Union ¶
Union returns a new slice containing the unique elements of the current slice and the provided other slice.
type HString ¶
type HString string
func NewHString ¶
NewHString creates a new HString from the provided string (optional).
func (HString) Compare ¶
Compare compares two HStrings and returns an HInt indicating their relative order.
func (HString) ContainsAny ¶
ContainsAny checks if the HString contains any character from the specified HString.
func (HString) ContainsRune ¶
ContainsRune checks if the HString contains the specified rune.
func (HString) Count ¶
Count returns the number of non-overlapping instances of the substring in the HString.
func (HString) Cut ¶
Cut returns a new HString that contains the text between the first occurrences of the 'start' and 'end' strings.
func (HString) Decode ¶
func (hs HString) Decode() dec
Decode returns a dec struct wrapping the given HString.
func (HString) Encode ¶
func (hs HString) Encode() enc
Encode returns an enc struct wrapping the given HString.
func (HString) Fields ¶
Fields splits the HString into a slice of substrings, removing any whitespace.
func (HString) HFloat ¶
HFloat tries to parse the HString as a float64 and returns an HFloat. If the conversion fails, it returns an HFloat with a value of 0.
func (HString) HInt ¶
HInt tries to parse the HString as an int and returns an HInt. If the conversion fails, it returns an HInt with a value of 0.
func (HString) Hash ¶
func (hs HString) Hash() shash
Hash returns a shash struct wrapping the given HString.
func (HString) Index ¶
Index returns the index of the first instance of the specified substring in the HString.
func (HString) IndexRune ¶
IndexRune returns the index of the first instance of the specified rune in the HString.
func (HString) Map ¶
Map applies the provided function to all runes in the HString and returns the resulting HString.
func (HString) NormalizeNFC ¶
NormalizeNFC returns a new HString with its Unicode characters normalized using the NFC form.
func (HString) Repeat ¶
Repeat returns a new HString consisting of the specified count of the original HString.
func (HString) Replace ¶
Replace replaces the 'oldS' HString with the 'newS' HString for the specified number of occurrences.
func (HString) ReplaceAll ¶
ReplaceAll replaces all occurrences of the 'oldS' HString with the 'newS' HString.
func (HString) Similarity ¶
Similarity calculates the similarity between two HStrings using the Levenshtein distance algorithm and returns the similarity percentage as an HFloat.
func (HString) Trim ¶
Trim trims characters in the cutset from the beginning and end of the HString.
func (HString) TrimLeft ¶
TrimLeft trims characters in the cutset from the beginning of the HString.
func (HString) TrimPrefix ¶
TrimPrefix trims the specified prefix from the HString.
func (HString) TrimSuffix ¶
TrimSuffix trims the specified suffix from the HString.