This commit is contained in:
2026-06-06 11:59:32 +02:00
parent 176cc0e62b
commit f91f9ff3b8
13 changed files with 866 additions and 90 deletions
+20 -2
View File
@@ -449,8 +449,10 @@ func candidates(d *Def, re *regexp.Regexp, q *qso.QSO, rl refList, hasList bool)
}
}
default:
// Whole field value is the candidate.
found = []string{normalizeRef(raw)}
// Whole field value is the candidate, split on comma/semicolon so a
// multi-reference field (e.g. an n-fer POTA QSO "US-6544,US-0680")
// counts each reference separately.
found = splitRefs(raw)
}
if !predefined {
@@ -547,6 +549,22 @@ func stripAffix(s, lead, trail string) string {
func normalizeRef(s string) string { return strings.ToUpper(strings.TrimSpace(s)) }
// splitRefs splits a field value on comma/semicolon into normalized references,
// so a multi-reference field (n-fer POTA "US-6544,US-0680") yields one entry
// per reference. A value with no separator yields a single reference.
func splitRefs(raw string) []string {
if !strings.ContainsAny(raw, ",;") {
return []string{normalizeRef(raw)}
}
var out []string
for _, p := range strings.FieldsFunc(raw, func(r rune) bool { return r == ',' || r == ';' }) {
if n := normalizeRef(p); n != "" {
out = append(out, n)
}
}
return dedupe(out)
}
func isDigit(b byte) bool { return b >= '0' && b <= '9' }
// natLess is a natural ("human") comparison: digit runs compare as numbers, so