Add IBAN validation

This commit is contained in:
2023-02-27 17:45:37 +01:00
parent 5480e4f9b9
commit f291504bd0
4 changed files with 103 additions and 39 deletions

View File

@ -21,5 +21,11 @@ namespace WGneu {
yield return childOfChild;
}
}
public static int Modulo(string a, int b) {
if (!a.All(char.IsDigit))
throw new ArgumentException("First argument has to be a decimal string");
return a.Select(ch => ch - '0').Aggregate((sum, n) => (sum * 10 + n) % b);
}
}
}