Version: v0.0.0-...-959e11f Latest Latest

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 3 Imported by: 0



Package charmatcher will contain methods to compare two strings to eachother, on different levels



This section is empty.


This section is empty.


This section is empty.


type CharMatcher

type CharMatcher struct {
	Chars []rune
	Input string

CharMatcher struct represents a Character Matcher object; used for comparison operations between slices of runes

func NewCharMatcher

func NewCharMatcher(input interface{}) (*CharMatcher, error)

NewCharMatcher will create a character matcher object based on the supplied input. Its methods will handle comparisons to other strings and CharMatchers

func (*CharMatcher) CompareTo

func (c *CharMatcher) CompareTo(input string, radix int) int

CompareTo method will return the difference in numeric values between two strings; comparing `abc` to `abd` = 1

func (*CharMatcher) Contains

func (c *CharMatcher) Contains(input string) bool

Contains method will return a boolean whether the input is present in the CharMatcher string (regardless where), provided it's present in its entirety. Similar implementation of MatchesAllOf method; and only accepts a string as input

func (*CharMatcher) ContainsAnyOf

func (c *CharMatcher) ContainsAnyOf(input string) bool

ContainsAnyOf method will check whether any of the input's individual characters are present in the CharMatcher

func (*CharMatcher) Index

func (c *CharMatcher) Index(input rune, index int) bool

Index method returns a boolean on whether the input character (rune) and index (int) provided matches the character in the same index, in the CharMatcher object

func (*CharMatcher) IndexOf

func (c *CharMatcher) IndexOf(input rune) (int, bool)

IndexOf method returns an int and boolean on whether the input character (rune) provided matches a similar character in the CharMatcher object; returns -1, false in case of no matches

func (*CharMatcher) IndexesOf

func (c *CharMatcher) IndexesOf(input rune) []int

IndexesOf method returns multiple matches of an input character (rune) in the CharMatcher object, in a slice of ints containing their indexes -- or a slice of ints containing -1 if there's no match

func (*CharMatcher) Matches

func (c *CharMatcher) Matches(input interface{}) (bool, error)

Matches method will compare two strings ensuring they match in length and exact content

func (*CharMatcher) MatchesAllOf

func (c *CharMatcher) MatchesAllOf(input interface{}) bool

MatchesAllOf method will return a boolean whether the input is present in the CharMatcher string (regardless where), provided it's present in its entirety

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL