string

package
v0.0.0-...-1d97044 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringAddURLParam

func StringAddURLParam(url, name, value string) string

func StringCSV

func StringCSV(records [][]string) string

func StringConvertTime

func StringConvertTime(timeString string, formatIn string, formatOut string) (string, *errorAVA.Error)

func StringEndsWithNumber

func StringEndsWithNumber(str string) bool

func StringEscapeJSON

func StringEscapeJSON(jsonString string) string

func StringFilter

func StringFilter(f func(string) bool, data []string) []string

func StringFind

func StringFind(str, token string) (remainder string, found bool)

func StringFindBetween

func StringFindBetween(str, start, stop string) (between, remainder string, found bool)

func StringFormatBigInt

func StringFormatBigInt(mem uint64) string

func StringFormatMemory

func StringFormatMemory(mem uint64) string

func StringInSlice

func StringInSlice(s string, slice []string) bool

func StringJoin

func StringJoin(values interface{}, sep string) string

func StringJoinFormat

func StringJoinFormat(format string, values interface{}, sep string) string

func StringListContains

func StringListContains(l []string, s string) bool

func StringListContainsCaseInsensitive

func StringListContainsCaseInsensitive(l []string, s string) bool

func StringMD5Hex

func StringMD5Hex(data string) string

func StringMapFunc

func StringMapFunc(f func(string) string, data []string) []string

func StringMapGroupedNumberPostfixSortedKeys

func StringMapGroupedNumberPostfixSortedKeys(m map[string]string) []string

func StringMapGroupedNumberPostfixSortedValues

func StringMapGroupedNumberPostfixSortedValues(m map[string]string) []string

func StringMapSortedKeys

func StringMapSortedKeys(m map[string]string) []string

func StringMarshalJSON

func StringMarshalJSON(data interface{}, indent string) string

func StringPrettifyJSON

func StringPrettifyJSON(compactJSON string) string

func StringReplaceHTMLTags

func StringReplaceHTMLTags(text, replacement string) (plainText string)

func StringReplaceMulti

func StringReplaceMulti(s string, fromTo ...string) string

func StringSHA1Base64

func StringSHA1Base64(data string) string

func StringSplitNumberPostfix

func StringSplitNumberPostfix(str string) (base, number string)

func StringSplitOnce

func StringSplitOnce(str, sep string) (pre, post string)

func StringSplitOnceChar

func StringSplitOnceChar(str string, sep byte) (pre, post string)

func StringSplitOnceRune

func StringSplitOnceRune(str string, sep rune) (pre, post string)

func StringStripHTMLTags

func StringStripHTMLTags(text string) (plainText string)

func StringToBool

func StringToBool(s string) bool

func StringToFloat

func StringToFloat(s string) float64

func StringToInt

func StringToInt(s string) int

func StringToLower

func StringToLower(str string) string

func StringToLowerCamelCase

func StringToLowerCamelCase(str string) string

func StringToUpper

func StringToUpper(str string) string

func StringToUpperCamelCase

func StringToUpperCamelCase(str string) string

Types

type String

type String string

func GetInstance

func GetInstance() *String

func (*String) AddURLParam

func (s *String) AddURLParam(url, name, value string) string

func (*String) CSV

func (s *String) CSV(records [][]string) string

func (*String) ConvertTime

func (s *String) ConvertTime(timeString string, formatIn string, formatOut string) (string, *errorAVA.Error)

func (*String) EndsWithNumber

func (s *String) EndsWithNumber(str string) bool

func (*String) EscapeJSON

func (s *String) EscapeJSON(jsonString string) string

func (*String) Filter

func (s *String) Filter(f func(string) bool, data []string) []string

Filter out all strings where the function does not return true.

func (*String) Find

func (s *String) Find(str, token string) (remainder string, found bool)

Find returns in found if token has been found in s, and returns the remaining string afte token in remainder. The whole string s will be returned if found is false.

func (*String) FindBetween

func (s *String) FindBetween(str, start, stop string) (between, remainder string, found bool)

FindBetween returns the string between the first occurrences of the tokens start and stop. The remainder of the string after the stop token will be returned if found. If the tokens couldn't be found, then the whole string will be returned as remainder.

func (*String) FormatBigInt

func (s *String) FormatBigInt(mem uint64) string

func (*String) FormatMemory

func (s *String) FormatMemory(mem uint64) string

func (*String) InSlice

func (s *String) InSlice(str string, slice []string) bool

func (*String) Join

func (s *String) Join(values interface{}, sep string) string

Join formats every value in values according to its default formatting and joins the result with sep as separator. values must be a slice of a formatable type

func (*String) JoinFormat

func (s *String) JoinFormat(format string, values interface{}, sep string) string

JoinFormat formats every value in values with format and joins the result with sep as separator. values must be a slice of a formatable type

func (*String) ListContains

func (s *String) ListContains(l []string, str string) bool

func (*String) ListContainsCaseInsensitive

func (s *String) ListContainsCaseInsensitive(l []string, str string) bool

func (*String) MD5Hex

func (s *String) MD5Hex(data string) string

MD5Hex returns the hex encoded MD5 hash of data

func (*String) MapFunc

func (s *String) MapFunc(f func(string) string, data []string) []string

Map a function on each element of a slice of strings.

func (*String) MapGroupedNumberPostfixSortedKeys

func (s *String) MapGroupedNumberPostfixSortedKeys(m map[string]string) []string

func (*String) MapGroupedNumberPostfixSortedValues

func (s *String) MapGroupedNumberPostfixSortedValues(m map[string]string) []string

func (*String) MapSortedKeys

func (s *String) MapSortedKeys(m map[string]string) []string

func (*String) MarshalJSON

func (s *String) MarshalJSON(data interface{}, indent string) string

MarshalJSON marshals data to an indented string.

func (*String) PrettifyJSON

func (s *String) PrettifyJSON(compactJSON string) string

func (*String) ReplaceHTMLTags

func (s *String) ReplaceHTMLTags(text, replacement string) (plainText string)

ReplaceHTMLTags replaces HTML/XML tags from text with replacement.

func (*String) ReplaceMulti

func (s *String) ReplaceMulti(str string, fromTo ...string) string

func (*String) SHA1Base64

func (s *String) SHA1Base64(data string) string

SHA1Base64 returns the base64 encoded SHA1 hash of data

func (*String) SplitNumberPostfix

func (s *String) SplitNumberPostfix(str string) (base, number string)

func (*String) SplitOnce

func (s *String) SplitOnce(str, sep string) (pre, post string)

func (*String) SplitOnceChar

func (s *String) SplitOnceChar(str string, sep byte) (pre, post string)

func (*String) SplitOnceRune

func (s *String) SplitOnceRune(str string, sep rune) (pre, post string)

func (*String) StripHTMLTags

func (s *String) StripHTMLTags(text string) (plainText string)

StripHTMLTags strips HTML/XML tags from text.

func (*String) ToBool

func (s *String) ToBool(str string) bool

func (*String) ToFloat

func (s *String) ToFloat(str string) float64

func (*String) ToInt

func (s *String) ToInt(str string) int

func (*String) ToLower

func (s *String) ToLower(str string) string

func (*String) ToLowerCamelCase

func (s *String) ToLowerCamelCase(str string) string

func (*String) ToUpper

func (s *String) ToUpper(str string) string

func (*String) ToUpperCamelCase

func (s *String) ToUpperCamelCase(str string) string

type StringGroupedNumberPostfixSorter

type StringGroupedNumberPostfixSorter []string

func (StringGroupedNumberPostfixSorter) Len

Len is the number of elements in the collection.

func (StringGroupedNumberPostfixSorter) Less

Less reports whether the element with index i should sort before the element with index j.

func (StringGroupedNumberPostfixSorter) Swap

Swap swaps the elements with indexes i and j.

type StringI

type StringI interface {
	MarshalJSON(data interface{}, indent string) string
	ListContains(l []string, s string) bool
	ListContainsCaseInsensitive(l []string, s string) bool
	PrettifyJSON(compactJSON string) string
	EscapeJSON(jsonString string) string
	StripHTMLTags(text string) (plainText string)
	ReplaceHTMLTags(text, replacement string) (plainText string)
	MD5Hex(data string) string
	SHA1Base64(data string) string
	AddURLParam(url, name, value string) string
	ConvertTime(timeString string, formatIn string, formatOut string) (string, *errorAVA.Error)
	CSV(records [][]string) string
	ToInt(s string) int
	ToFloat(s string) float64
	ToBool(s string) bool
	InSlice(s string, slice []string) bool
	JoinFormat(format string, values interface{}, sep string) string
	Join(values interface{}, sep string) string
	FormatBigInt(mem uint64) string
	FormatMemory(mem uint64) string
	ReplaceMulti(str string, fromTo ...string) string
	ToUpperCamelCase(str string) string
	ToLowerCamelCase(str string) string
	ToLower(str string) string
	ToUpper(str string) string
	MapSortedKeys(m map[string]string) []string
	MapGroupedNumberPostfixSortedKeys(m map[string]string) []string
	MapGroupedNumberPostfixSortedValues(m map[string]string) []string
	EndsWithNumber(s string) bool
	SplitNumberPostfix(s string) (base, number string)
	SplitOnce(s, sep string) (pre, post string)
	SplitOnceChar(s string, sep byte) (pre, post string)
	SplitOnceRune(s string, sep rune) (pre, post string)
	MapFunc(f func(string) string, data []string) []string
	Filter(f func(string) bool, data []string) []string
	FindBetween(s, start, stop string) (between, remainder string, found bool)
	Find(s, token string) (remainder string, found bool)
}

type StringMap

type StringMap map[string]string

StringMap is a map[string]string.

func (StringMap) MarshalXML

func (s StringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) *errorAVA.Error

StringMap marshals into XML.

func (StringMap) UnmarshalXML

func (s StringMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) *errorAVA.Error

type StringSet

type StringSet map[string]struct{}

StringSet wraps map[string]struct{} with some useful methods.

func (StringSet) Clone

func (set StringSet) Clone() StringSet

func (StringSet) Delete

func (set StringSet) Delete(s string)

func (StringSet) Exclude

func (set StringSet) Exclude(other StringSet)

func (StringSet) Has

func (set StringSet) Has(s string) bool

func (StringSet) Join

func (set StringSet) Join(other StringSet)

func (StringSet) ReverseSorted

func (set StringSet) ReverseSorted() []string

func (StringSet) Set

func (set StringSet) Set(s string)

func (StringSet) Sorted

func (set StringSet) Sorted() []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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