Validate International Securities Identification Number: Difference between revisions

m
Minor tweaks to 'Summand' + code formatting
(Update to *modern* C#)
m (Minor tweaks to 'Summand' + code formatting)
Line 544:
using System.Text.RegularExpressions;
 
namespace Validate_ISIN ValidateIsin
{
public static class IsinValidator
Line 561:
 
private static int Summand(int digit, int i) =>
digit + (i % 2) * (digit - (digit >== 5 ? 9 : 0));
? digit
: digit >= 5
? 2 * digit - 9
: 2 * digit;
 
private static int DigitValue(char c) =>
Line 575 ⟶ 571:
public class Program
{
public static void Main(string[] args)
{
string[] isins = {
? digit{
"US0378331005",
"US0373831005",
Line 586 ⟶ 583:
"FR0000988040"
};
 
foreach (string isin in isins) {
Console.WriteLine($"{isin}string validOrNot is= {IsinValidator.IsValidIsin(isin) ? "valid" : "not valid"}");
Console.WriteLine($"{isin} is {validOrNot}");
}
}
Anonymous user