stringutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 1 Imported by: 34

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StringDeduplicator

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

func NewStringDeduplicator

func NewStringDeduplicator(lock bool) *StringDeduplicator

NewStringDeduplicator will create a StringDeduplicator which may be used to eliminate duplicate string contents. It maintains an internal map of unique strings. If lock is true then each method call will take an exclusive lock.

func (*StringDeduplicator) Clear

func (d *StringDeduplicator) Clear()

Clear will clear the internal map and statistics.

func (*StringDeduplicator) DeDuplicate

func (d *StringDeduplicator) DeDuplicate(str string) string

DeDuplicate will return a string which has the same contents as str. This method should be called for every string in the application.

func (*StringDeduplicator) GetStatistics

GetStatistics will return de-duplication statistics.

type StringDuplicationStatistics

type StringDuplicationStatistics struct {
	DuplicateBytes   uint64
	DuplicateStrings uint64
	UniqueBytes      uint64
	UniqueStrings    uint64
}

Jump to

Keyboard shortcuts

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