stringutils

package
v0.0.103 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 9 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BOMS = [][]byte{
	{0xef, 0xbb, 0xbf},
	{0xfe, 0xff},
	{0xff, 0xfe},
	{0x00, 0x00, 0xfe, 0xff},
	{0xff, 0xfe, 0x00, 0x00},
}
View Source
var CUTSET = " \n\r\t"

Functions

func ArrayToMap added in v0.0.74

func ArrayToMap(slice []string) map[string]struct{}

func CheckPalindrome added in v0.0.19

func CheckPalindrome(str string) bool

CheckPalindrome is delegated to verify if the given string is palindrome

func ContainsMultiple added in v0.0.28

func ContainsMultiple(lower bool, s string, substring ...string) bool

ContainsMultiple is delegated to verify if the given string 's' contains all the 'substring' present

func CountLines

func CountLines(str string) int

CountLines return the number of lines in the given string

func CreateJSON

func CreateJSON(values []string) string

CreateJSON is delegated to create a simple json object for the key pair in input

func DiceCoefficient added in v0.0.22

func DiceCoefficient(string1, string2 string) float64

DiceCoefficient is bigram position dependent implementation of the Dice coefficient

func ExtractString

func ExtractString(data, first, last string) string

ExtractString is delegated to filter the content of the given data delimited by 'first' and 'last' string

func GetFirstRune added in v0.0.41

func GetFirstRune(data string) rune

func HasPrefixes added in v0.0.103

func HasPrefixes(prefixs []string, target string) bool

func Indexes added in v0.0.94

func Indexes(s, chs string) []int

func IsASCII

func IsASCII(s string) bool

IsASCII is delegated to verify if a given string is ASCII compliant

func IsASCIIRune added in v0.0.4

func IsASCIIRune(r rune) bool

IsASCIIRune is delegated to verify if the given character is ASCII compliant

func IsAlpha added in v0.0.103

func IsAlpha(str string) bool

func IsBlank added in v0.0.6

func IsBlank(str string) bool

IsBlank is delegated to verify that the string does not contain only empty char

func IsLower added in v0.0.2

func IsLower(s string) bool

IsLower verify that a string contains only upper character

func IsUpper

func IsUpper(s string) bool

IsUpper verify that a string contains only upper character

func JaroDistance added in v0.0.22

func JaroDistance(str1, str2 string) float64

JaroDistance is delegated to calculate the Jaro distance from the two given string

func Join

func Join(strs ...string) string

Join is a quite efficient string "concatenator"

func LevenshteinDistance added in v0.0.22

func LevenshteinDistance(str1, str2 string) int

LevenshteinDistance is an optimized version for calculate the Levenshtein distance

func Pad added in v0.0.101

func Pad(word, v string, n int) string

func RemoveFromString

func RemoveFromString(data string, i int) string

RemoveFromString Remove a given character in position i from the input string

func RemoveNonASCII added in v0.0.5

func RemoveNonASCII(str string) string

RemoveNonASCII is delegated to clean the text from the NON ASCII character

func ReplaceAtIndex added in v0.0.3

func ReplaceAtIndex(str, replacement string, index int) string

ReplaceAtIndex is delegated to replace the character related to the index with the input rune

func ReverseString added in v0.0.19

func ReverseString(str string) string

ReverseString is delegated to return the reverse of the input string

func Split

func Split(data io.Reader) []string

Split is delegated to split the string by the new line

func ToByte added in v0.0.103

func ToByte(slice []string, separator string) []byte

func Trim added in v0.0.6

func Trim(str string) string

Trim is delegated to remove the initial, final whitespace and the double whitespace present in the data

func TrimStrings added in v0.0.101

func TrimStrings(vs []string) []string

Types

This section is empty.

Jump to

Keyboard shortcuts

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