stringsutils

package
v0.448.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLinePrefix

func AddLinePrefix(context string, linePrefix string) (output string)

func ContainsAtLeastOneSubstring

func ContainsAtLeastOneSubstring(input string, substrings []string) (atLeastOneSubstringFound bool)

func ContainsAtLeastOneSubstringIgnoreCase

func ContainsAtLeastOneSubstringIgnoreCase(input string, substring []string) (atLeastOneSubstringFound bool)

func ContainsCommentOnly

func ContainsCommentOnly(input string) (containsCommentOnly bool)

func ContainsIgnoreCase

func ContainsIgnoreCase(input string, substring string) (contains bool)

func ContainsLine

func ContainsLine(input string, line string) (containsLine bool)

func CountLines

func CountLines(input string) (nLines int)

func EnsureEndsWithExactlyOneLineBreak

func EnsureEndsWithExactlyOneLineBreak(input string) (ensuredLineBreak string)

func EnsureEndsWithLineBreak

func EnsureEndsWithLineBreak(input string) (ensuredLineBreak string)

func EnsureFirstCharLowercase

func EnsureFirstCharLowercase(input string) (firstCharUppercase string)

func EnsureFirstCharUppercase

func EnsureFirstCharUppercase(input string) (firstCharUppercase string)

func EnsurePrefix

func EnsurePrefix(input string, prefix string) (ensuredPrefix string)

func EnsureSuffix

func EnsureSuffix(input string, suffix string) (ensuredSuffix string)

func FirstCharToUpper

func FirstCharToUpper(input string) (output string)

func GetAsKeyValues

func GetAsKeyValues(input string) (output map[string]string, err error)

func GetFirstLine

func GetFirstLine(input string) (firstLine string)

func GetFirstLineAndTrimSpace

func GetFirstLineAndTrimSpace(input string) (firstLine string)

func GetFirstLineWithoutCommentAndTrimSpace

func GetFirstLineWithoutCommentAndTrimSpace(input string) (firstLine string)

func GetNumberOfLinesWithPrefix

func GetNumberOfLinesWithPrefix(content string, prefix string, trimLines bool) (numberOfLinesWithPrefix int)

func GetValueAsInt

func GetValueAsInt(input string, key string) (value int, err error)

func GetValueAsString

func GetValueAsString(input string, key string) (value string, err error)

func HasAtLeastOnePrefix

func HasAtLeastOnePrefix(toCheck string, prefixes []string) (hasPrefix bool)

func HasPrefixIgnoreCase

func HasPrefixIgnoreCase(input string, prefix string) (hasPrefix bool)

func HexStringToBytes

func HexStringToBytes(hexString string) (output []byte, err error)

func IsBeforeInAlphabeth

func IsBeforeInAlphabeth(s1 string, s2 string) (isBefore bool)

Returns true if s1 comes before s2 in the alphabeth. Alphabethical order is: - empty string - numbers [0-9] - chars [a-z]

func IsComment

func IsComment(input string) (isComment bool)

func IsFirstCharLowerCase

func IsFirstCharLowerCase(input string) (isFirstCharLowerCase bool)

func IsFirstCharUpperCase

func IsFirstCharUpperCase(input string) (isFirstCharUpperCase bool)

func MatchesRegex

func MatchesRegex(input string, regex string) (matches bool, err error)

func MustGetAsKeyValues

func MustGetAsKeyValues(input string) (output map[string]string)

func MustGetValueAsInt

func MustGetValueAsInt(input string, key string) (value int)

func MustGetValueAsString

func MustGetValueAsString(input string, key string) (value string)

func MustHexStringToBytes

func MustHexStringToBytes(hexString string) (output []byte)

func MustMatchesRegex

func MustMatchesRegex(input string, regex string) (matches bool)

func RemoveCommentMarkers

func RemoveCommentMarkers(input string) (commentContent string)

func RemoveCommentMarkersAndTrimSpace

func RemoveCommentMarkersAndTrimSpace(input string) (commentContent string)

func RemoveComments

func RemoveComments(input string) (contentWithoutComments string)

func RemoveCommentsAndTrimSpace

func RemoveCommentsAndTrimSpace(input string) (output string)

func RemoveLinesWithPrefix

func RemoveLinesWithPrefix(input string, prefixToRemove string) (output string)

func RemoveSurroundingQuotationMarks

func RemoveSurroundingQuotationMarks(input string) (output string)

func RemoveTailingNewline

func RemoveTailingNewline(input string) (cleaned string)

func RepeatReplaceAll

func RepeatReplaceAll(input string, search string, replaceWith string) (replaced string)

func RightFillWithSpaces

func RightFillWithSpaces(input string, fillLength int) (filled string)

func SplitAndGetLastElement

func SplitAndGetLastElement(input string, token string) (lastElement string)

func SplitAtSpacesAndRemoveEmptyStrings

func SplitAtSpacesAndRemoveEmptyStrings(input string) (splitted []string)

func SplitFirstLineAndContent

func SplitFirstLineAndContent(input string) (firstLine string, contentWithoutFirstLine string)

func SplitLines

func SplitLines(input string, removeLastLineIfEmpty bool) (splittedLines []string)

func SplitWords

func SplitWords(input string) (words []string)

func ToHexString

func ToHexString(input string, delimiter string) (hexString string)

Convert "input" to a hex string while every char is separated by the "delimiter".

func ToHexStringSlice

func ToHexStringSlice(input string) (hexStringSlice []string)

Convert "input" to a hex string slices while every element of the hexStringSlice is the value of a char in hex as string.

func ToPascalCase

func ToPascalCase(input string) (pascalCase string)

func ToSnakeCase

func ToSnakeCase(input string) (snakeCase string)

func TrimAllLeadingAndTailingNewLines

func TrimAllLeadingAndTailingNewLines(input string) (output string)

func TrimAllLeadingNewLines

func TrimAllLeadingNewLines(input string) (output string)

func TrimAllPrefix

func TrimAllPrefix(stringToCheck string, prefixToRemove string) (trimmedString string)

func TrimAllSuffix

func TrimAllSuffix(stringToCheck string, suffixToRemove string) (trimmedString string)

func TrimAllTailingNewLines

func TrimAllTailingNewLines(input string) (output string)

func TrimPrefixAndSuffix

func TrimPrefixAndSuffix(input string, prefix string, suffix string) (output string)

func TrimPrefixIgnoreCase

func TrimPrefixIgnoreCase(input string, prefix string) (trimmed string)

func TrimSpaceForEveryLine

func TrimSpaceForEveryLine(input string) (trimmedForEveryLine string)

func TrimSpacesLeft

func TrimSpacesLeft(input string) (trimmedLeft string)

func TrimSpacesRight

func TrimSpacesRight(input string) (trimmedLeft string)

func TrimSuffixAndSpace

func TrimSuffixAndSpace(input string, suffix string) (output string)

func TrimSuffixUntilAbsent

func TrimSuffixUntilAbsent(input string, suffixToRemove string) (withoutSuffix string)

Types

type StringsService

type StringsService struct{}

func NewStringsService

func NewStringsService() (s *StringsService)

func Strings

func Strings() (stringsService *StringsService)

Jump to

Keyboard shortcuts

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