Documentation ¶
Overview ¶
Package stringcmp contains tools for comparing strings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsAnyOf ¶
ContainsAnyOf checks if the given text contains any of the provided substrings. It returns the substring that matched or the empty string if none matched.
func ContainsSurrounded ¶
ContainsSurrounded checks whether the substring is contained in s and is surrounded by (unicode) spaces.
func ContainsSurroundedIgnoreSpace ¶
ContainsSurroundedIgnoreSpace checks whether the given substring is contained in s. The check ignores spaces within the substring, as long as it is surrounded by spaces in s.
func GetWordsFocusedString ¶
GetWordsFocusedString prepares a string in a manner which makes it useful for word by word comparisons.
Types ¶
type RuneMapper ¶
RuneMapper is a function which maps a rune to a rune.
func ChainMapper ¶
func ChainMapper(mappers ...RuneMapper) RuneMapper
ChainMapper creates a new RuneMapper which calls the given RuneMapper functions sequentially and return the final result.
func LowerMapper ¶
func LowerMapper() RuneMapper
LowerMapper maps the rune to its lowercase representation.
func RemoveNonLettersMapper ¶
func RemoveNonLettersMapper() RuneMapper
RemoveNonLetterMapper returns a RuneMapper that removes all runes that aren't letters or numbers.
func RemoveSpaceMapper ¶
func RemoveSpaceMapper() RuneMapper
RemoveSpaceMapper returns a RuneMapper that removes all unicode space runes.
func ReplaceNonLettersWithSpaceMapper ¶
func ReplaceNonLettersWithSpaceMapper() RuneMapper
ReplaceNonLettersWithSpaceMapper maps runes which aren't letters or numbers to a space, but it only ever uses one space in a row.