strings

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RxParseHtmlTagKeyOnly    = regexp.MustCompile(`^([a-zA-Z][-a-zA-Z0-9]+)$`)
	RxParseHtmlTagKeyValue   = regexp.MustCompile(`^([a-zA-Z][-a-zA-Z0-9]+)=(.+?)$`)
	RxSplitHtmlTagAttributes = regexp.MustCompile(`\s+`)
)
View Source
var RxBasicMimeType = regexp.MustCompile(`^\s*([^\s;]*)\s*.+?\s*$`)
View Source
var RxEmpty = regexp.MustCompile(`(?ms)\A\s*\z`)
View Source
var RxQuoteStringsOnly = regexp.MustCompile(`(?i)^(true|false|-?\d*[.,]?\d*)$`)
View Source
var RxTmplTags = regexp.MustCompile(`\{\{.+?}}`)
View Source
var RxWord = regexp.MustCompile(`\w+`)

Functions

func AddClassNamesToNjnBlock

func AddClassNamesToNjnBlock(data map[string]interface{}, classes ...string) map[string]interface{}

func AppendWithSpace

func AppendWithSpace(src, add string) (combined string)

func Empty

func Empty(value string) (empty bool)

func EscapeHtmlAttribute

func EscapeHtmlAttribute(unescaped string) (escaped string)

func FirstName

func FirstName(fullName string) (firstName string)

func GetBasicMime

func GetBasicMime(mime string) (basic string)

func IsFalse

func IsFalse(text string) bool

func IsTrue

func IsTrue(text string) bool

func LastName

func LastName(fullName string) (lastName string)

func LowerStrings

func LowerStrings(in ...string) (out []string)

func ParseHtmlTagAttributes

func ParseHtmlTagAttributes(input interface{}) (attributes map[string]interface{}, err error)

func PathToSnake added in v0.2.0

func PathToSnake(path string) (snake string)

func QuoteJsonValue

func QuoteJsonValue(in string) (out string)

QuoteJsonValue will quote everything other than numbers or boolean text

func RemoveIndexFromStrings

func RemoveIndexFromStrings(idx int, slice []string) []string

func RemoveValueFromSlice added in v0.1.0

func RemoveValueFromSlice(value string, slice *[]string) (modified bool)

func StringInSlices

func StringInSlices(src string, dst ...[]string) bool

func StringInStrings

func StringInStrings(src string, dst ...string) bool

func StringIndexInSlice

func StringIndexInSlice(src string, dst []string) int

func StringIndexInStrings

func StringIndexInStrings(src string, dst ...string) int

func StringsToKebabs

func StringsToKebabs(in ...string) (out []string)

func StripTmplTags

func StripTmplTags(value string) (clean string)

func TitleCase

func TitleCase(input string) (output string)

func TrimPrefixes

func TrimPrefixes(value string, prefixes ...string) (trimmed string)

func TrimQuotes

func TrimQuotes(quoted string) (unquoted string)

func UniqueFromSpaceSep

func UniqueFromSpaceSep(value string, original []string) (updated []string)

Types

type SortByLengthAsc

type SortByLengthAsc []string

func (SortByLengthAsc) Len

func (a SortByLengthAsc) Len() int

func (SortByLengthAsc) Less

func (a SortByLengthAsc) Less(i, j int) bool

func (SortByLengthAsc) Swap

func (a SortByLengthAsc) Swap(i, j int)

type SortByLengthDesc

type SortByLengthDesc []string

func (SortByLengthDesc) Len

func (a SortByLengthDesc) Len() int

func (SortByLengthDesc) Less

func (a SortByLengthDesc) Less(i, j int) bool

func (SortByLengthDesc) Swap

func (a SortByLengthDesc) Swap(i, j int)

Jump to

Keyboard shortcuts

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