Skip to content

Commit 1982979

Browse files
committed
docs
1 parent 8b5c59e commit 1982979

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎internal/strdist/strdist.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ func globCost(ar, br rune) Cost {
135135
return Cost{SwapAB: 1, DeleteA: 1, InsertB: 1}
136136
}
137137

138+
// wildcardPrefixMatch compares whether the prefixes of a and b are equal up
139+
// to the shortest one. The prefix is defined as the longest substring that
140+
// starts at index 0 and does not contain a wildcard.
138141
func wildcardPrefixMatch(a, b string) bool {
139142
ai := strings.IndexAny(a, "*?")
140143
bi := strings.IndexAny(b, "*?")
@@ -148,6 +151,9 @@ func wildcardPrefixMatch(a, b string) bool {
148151
return a[:mini] == b[:mini]
149152
}
150153

154+
// wildcardSuffixMatch compares whether the suffixes of a and b are equal up
155+
// to the shortest one. The suffix is defined as the longest substring that ends
156+
// at the string length and does not contain a wildcard.
151157
func wildcardSuffixMatch(a, b string) bool {
152158
ai := strings.LastIndexAny(a, "*?")
153159
la := 0

0 commit comments

Comments
 (0)