Entities/Member: Add OrganicAuthorityCode
Test / Run tests (push) Successful in 2m4s

This commit is contained in:
2026-08-29 15:35:40 +02:00
parent cc01f92005
commit c2e97abc5a
13 changed files with 48 additions and 35 deletions
+15 -7
View File
@@ -631,15 +631,18 @@ namespace Elwig.Helpers {
if (v < 2 && char.IsAsciiLetter(ch)) {
v++;
text += ch;
} else if ((v == 2 || v == 6) && ch == '-') {
v++;
} else if ((v == 2 || v == 5) && ch == '-' && text[^1] != '-') {
text += ch;
} else if (v >= 2 && char.IsLetterOrDigit(ch)) {
} else if (v >= 2 && v <= 4 && char.IsLetter(ch)) {
if (v == 2 && text[^1] != '-')
text += "-";
if (text.StartsWith("AT")) {
if (v == 3 && ch == 'B' || v == 4 && ch == 'I' || v == 5 && ch == 'O') {
if (v == 2 && ch == 'B' || v == 3 && ch == 'I' || v == 4 && ch == 'O') {
v++;
text += ch;
} else if (v > 6 && char.IsAsciiDigit(ch)) {
}
} else if (text.StartsWith("DE")) {
if (v == 2 && ch == 'Ö' || v == 3 && ch == 'K' || v == 4 && ch == 'O') {
v++;
text += ch;
}
@@ -647,11 +650,16 @@ namespace Elwig.Helpers {
v++;
text += ch;
}
} else if (v >= 5 && v <= 7 && char.IsAsciiDigit(ch)) {
if (v == 5 && text[^1] != '-')
text += "-";
v++;
text += ch;
}
if (i == input.CaretIndex - 1) {
pos = text.Length;
} else if (text.StartsWith("AT") && v >= 10) {
} else if ((text.StartsWith("AT") || text.StartsWith("DE")) && v >= 10) {
break;
}
}
@@ -662,7 +670,7 @@ namespace Elwig.Helpers {
if (text.Length == 0)
return required ? new(false, "Bio-Kontrollstellen-Code ist nicht optional") : new(true, null);
if (text.StartsWith("AT")) {
if (text.StartsWith("AT") || text.StartsWith("DE")) {
if (text.Length != 10) {
return new(false, "Bio-Kontrollstellen-Code ist ungültig");
}