dvtextutils

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

********************************************************************** MicroCore Copyright 2020 - 2024 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************

Index

Constants

This section is empty.

Variables

View Source
var JsonEscapeTable = map[byte]byte{
	'\\':     '\\',
	'"':      '"',
	byte(8):  'b',
	byte(9):  't',
	byte(10): 'r',
	byte(12): 'f',
	byte(13): 'n',
}
View Source
var SubstitutionEndParameter = []byte{'}'}
View Source
var SubstitutionStartParameter = []byte{'$', '{'}
View Source
var UINT8_COUNT = 256

Functions

func AddNonRepeatingWords

func AddNonRepeatingWords(s string, oldList, newList []string, imap map[string]int, plain, joiner string) string

func AddStringListWithoutRepeats

func AddStringListWithoutRepeats(src []string, newList []string) []string

func CalculateStringCheckSum

func CalculateStringCheckSum(data string) int64

func CheckSimplePrefixedWords

func CheckSimplePrefixedWords(list []string, prefix string) bool

func CheckSimplePrefixedWordsWithDash

func CheckSimplePrefixedWordsWithDash(list []string, prefix string) bool

func ComposeParametersInTemplate

func ComposeParametersInTemplate(template string, brackets int, value string) (res map[string]string, ok bool)

func ConvertArrayStringMapIntoSimpleStringMap

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

func ConvertToList

func ConvertToList(lst string) []string

func ConvertToNonEmptyList

func ConvertToNonEmptyList(lst string) []string

func ConvertToNonEmptyListByEOL

func ConvertToNonEmptyListByEOL(lst string) []string

func ConvertToNonEmptyListBySeparator

func ConvertToNonEmptyListBySeparator(lst string, separator string) []string

func ConvertToNonEmptySemicolonList

func ConvertToNonEmptySemicolonList(lst string) []string

func ConvertToUpperAlphaDigital

func ConvertToUpperAlphaDigital(b []byte) string

func ConvertURLToList

func ConvertURLToList(url string) []string

func CopyStringMap

func CopyStringMap(src map[string]string) map[string]string

func DecomposeUrlEncodedString

func DecomposeUrlEncodedString(s string) (r map[string][]string, err error)

func EncodeURI

func EncodeURI(s string) string

func EvaluateDifferenceRate

func EvaluateDifferenceRate(model string, pattern string) int

func FindByRegularExpression

func FindByRegularExpression(source string, regexpr string, group string, defvalue string, isall bool, count int) (interface{}, error)

func FindIndexInStringArray

func FindIndexInStringArray(data []string, key string) int

func FindNonEmptyLastString

func FindNonEmptyLastString(data []string) string

func GetBytesFromPointCode

func GetBytesFromPointCode(v int) []byte

func GetCanonicalVersion

func GetCanonicalVersion(version int64) string

func GetCanonicalVersionFromHexName

func GetCanonicalVersionFromHexName(version string) string

func GetCodePoint

func GetCodePoint(b []byte) int

func GetKeysFromStringIntMap

func GetKeysFromStringIntMap(data map[string]int) []string

func GetLowCaseExtension

func GetLowCaseExtension(name string) string

func GetNextNonEmptyPartInYaml

func GetNextNonEmptyPartInYaml(s string) string

func GetNextWordBySpaceTable

func GetNextWordBySpaceTable(s string, spaceTable map[byte]bool, allRest bool) string

func GetNextWordExceptYamlControls

func GetNextWordExceptYamlControls(s string) string

func GetNextWordInText

func GetNextWordInText(s string) string

func GetStringArrayWithDefaults

func GetStringArrayWithDefaults(src []string, defs []string) []string

func GetUnquotedString

func GetUnquotedString(data string) string

func GetVersionIndex

func GetVersionIndex(version string) int64

func InsertTextIntoBuffer

func InsertTextIntoBuffer(src []byte, posStart int, posEnd int, buf ...[]byte) (dst []byte, dif int)

func Int64ToFullHex

func Int64ToFullHex(v int64) string

func IsAlphabeticalLowCase

func IsAlphabeticalLowCase(s string) bool

func IsDigitOnly

func IsDigitOnly(s string) bool

func IsJsonNumber

func IsJsonNumber(d []byte) bool

func IsJsonString

func IsJsonString(str []byte) bool

func IsSignAndDigitsOnly

func IsSignAndDigitsOnly(s string) bool

func IsSimpleWord

func IsSimpleWord(s string) bool

func IsSimpleWordWithDash

func IsSimpleWordWithDash(s string) bool

func IsStringContainedInArray

func IsStringContainedInArray(s string, collection []string) bool

func IsStringContainedInStringToAnyMap

func IsStringContainedInStringToAnyMap(s string, collection map[string]interface{}) bool

func IsStringContainedInStringToStringMap

func IsStringContainedInStringToStringMap(s string, collection map[string]string) bool

func IsUpperAlphaDigital

func IsUpperAlphaDigital(s string) bool

func IsUpperAlphaDigitalBytes

func IsUpperAlphaDigitalBytes(b []byte) bool

func IsValidVariableName

func IsValidVariableName(data string, uniAllowed bool) int

func LoadSimpleMapFromByteArray

func LoadSimpleMapFromByteArray(data []byte, separator byte) map[string]string

func LoadSimpleMapFromFile

func LoadSimpleMapFromFile(fileName string, separator byte) (res map[string]string, err error)

func LoadSimpleMapFromString

func LoadSimpleMapFromString(data string) map[string]string

func LookInDescriptionByteArray

func LookInDescriptionByteArray(data []byte, lookNames map[string]string, mustPresent bool) (res map[string]string, err error)

func LookInDescriptionFile

func LookInDescriptionFile(fileName string, lookNames map[string]string, mustPresent bool) (res map[string]string, err error)

func MakeUniqueStringList

func MakeUniqueStringList(lists ...[]string) []string

func MatchParametersByVariableSubstitution

func MatchParametersByVariableSubstitution(model string, list []string, rest []string, occurrence int, strict bool) (params map[string]string, doubt bool, ok bool)

func PrepareAndMayQuoteParams

func PrepareAndMayQuoteParams(src []string) (string, int)

func PresentMapAsProperties

func PresentMapAsProperties(pool map[string]string, outputFileName string) error

func PrintInt64ToByteBuffer

func PrintInt64ToByteBuffer(n int64, b []byte) int

func PutDescribedAttributesToMapFromCommaSeparatedList

func PutDescribedAttributesToMapFromCommaSeparatedList(params map[string]string, pool map[string]string, list string) error

func PutDescribedAttributesToMapFromEOLSeparatedList

func PutDescribedAttributesToMapFromEOLSeparatedList(params map[string]string, pool map[string]string, list string) error

func PutDescribedAttributesToMapFromList

func PutDescribedAttributesToMapFromList(params map[string]string, pool map[string]string, list []string) error

func QuickLookJsonOption

func QuickLookJsonOption(s string, option string) string

func QuoteEscapedJsonBytes

func QuoteEscapedJsonBytes(b []byte) []byte

func QuoteEscapedJsonBytesToString

func QuoteEscapedJsonBytesToString(b []byte) string

func QuoteEscapedJsonString

func QuoteEscapedJsonString(s string) string

func ReadHexValue

func ReadHexValue(v string) int64

func ReadInsideBrackets

func ReadInsideBrackets(str string, pos int) (endPos int, err error)

func ReadScreenedString

func ReadScreenedString(s string) string

func ReduceListRestByKnownValueAtIndex

func ReduceListRestByKnownValueAtIndex(list []string, rest []string, index int, value string) ([]string, []string, int)

func ReduceListToNonEmptyList

func ReduceListToNonEmptyList(res []string) []string

func ReduceSpaceAndCountWords

func ReduceSpaceAndCountWords(str string) (string, int)

func ReplaceByRegularExpression

func ReplaceByRegularExpression(source string, regexpr string, replacement string, isLiteral bool) (string, error)

func ReplaceWordBySpaceOrSemicolonOrEnd

func ReplaceWordBySpaceOrSemicolonOrEnd(src string, repl string, pos int) string

func ReverseStringArray

func ReverseStringArray(s []string) []string

func SeparateBytesToUTF8Chars

func SeparateBytesToUTF8Chars(b []byte) [][]byte

func SeparateChildExpression

func SeparateChildExpression(name string) (res []string)

func SeparateToKeyValue

func SeparateToKeyValue(line string) (key string, value string)

func SmartReadQuotedStringEndPos

func SmartReadQuotedStringEndPos(s string, pos int) (int, bool)

func SmartReadStringList

func SmartReadStringList(s string, nonEmpty bool) []string

func SmartReadUnquotedStringEndPos

func SmartReadUnquotedStringEndPos(s string, pos int) int

func SortStringArray

func SortStringArray(src []string, options []string) []string

func SortStringArrayByOption

func SortStringArrayByOption(src []string, option string) []string

func SortStringArrayByOrder

func SortStringArrayByOrder(src []string, desc bool) []string

func SubstitutionGetList

func SubstitutionGetList(data []byte) (list []string, rest []string, ok bool)

func SubstitutionMatchModelByPattern

func SubstitutionMatchModelByPattern(model string, pattern string, hintOccurrence int, hintStrict bool) (params map[string]string, doubt bool, ok bool)

func SubstitutionsGetNextPosition

func SubstitutionsGetNextPosition(list []string, rest []string, positions []int, model string) bool

func SubstitutionsGetNextPositionFromLast

func SubstitutionsGetNextPositionFromLast(list []string, rest []string, positions []int, model string) bool

func SubstitutionsGetParamsByPositions

func SubstitutionsGetParamsByPositions(list []string, rest []string, positions []int, model string) map[string]string

func TryReadInteger

func TryReadInteger(str string, def int) int

func UpdateModelByListRestParams

func UpdateModelByListRestParams(pattern string, list []string, rest []string, paramMap map[string]string, silent bool) (string, error)

func UpdateModelByParamGetter

func UpdateModelByParamGetter(pattern string, paramGetter func(string) (string, bool)) (string, []string)

func UpdateModelByParams

func UpdateModelByParams(pattern string, paramMap map[string]string) (string, error)

func UpdateModelByParamsSilent

func UpdateModelByParamsSilent(pattern string, paramMap map[string]string) (string, error)

Types

type RegExpession

type RegExpession struct {
	Pattern       string
	Flags         string
	Compiled      *regexp.Regexp
	ResultWord    string
	ResultIndices [][]int
	ResultCount   int
	GlobalSearch  bool
}

func NewRegExpression

func NewRegExpression(pattern string, flags string) (*RegExpession, error)

Jump to

Keyboard shortcuts

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