stringcmp

package
v0.0.0-...-c928bda Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package stringcmp contains tools for comparing strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsAnyOf

func ContainsAnyOf(text string, substrs ...string) string

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

func ContainsSurrounded(s, substring string) bool

ContainsSurrounded checks whether the substring is contained in s and is surrounded by (unicode) spaces.

func ContainsSurroundedIgnoreSpace

func ContainsSurroundedIgnoreSpace(s, substring string) bool

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

func GetWordsFocusedString(s string) string

GetWordsFocusedString prepares a string in a manner which makes it useful for word by word comparisons.

Types

type RuneMapper

type RuneMapper = func(rune) rune

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.

Jump to

Keyboard shortcuts

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