Class CheckDigit
Compute and validate text value digits (ISO 7064 compatible)
Inherited Members
Namespace: PayrollEngine.Client.Scripting
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public class CheckDigit
Remarks
See https://github.com/gravity00/SimpleISO7064 and https://en.wikipedia.org/wiki/International_Bank_Account_Number
Constructors
View SourceCheckDigit(int, int, string, bool)
Creates a new instance
Declaration
public CheckDigit(int modulus, int radix, string characterSet, bool doubleCheckDigit)
Parameters
| Type | Name | Description |
|---|---|---|
| int | modulus | The modulus |
| int | radix | The radix |
| string | characterSet | The supported character set |
| bool | doubleCheckDigit | Is the computed check digit composed by two characters? |
Properties
View SourceCharacterSet
The supported character set
Declaration
public string CharacterSet { get; }
Property Value
| Type | Description |
|---|---|
| string |
DoubleCheckDigit
Double check digit
Declaration
public bool DoubleCheckDigit { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Mod11Radix2
Check numeric strings with one check digit or the supplementary check character "X"
Declaration
public static CheckDigit Mod11Radix2 { get; }
Property Value
| Type | Description |
|---|---|
| CheckDigit |
Mod1271Radix36
Check alphabetic strings with two check letters
Declaration
public static CheckDigit Mod1271Radix36 { get; }
Property Value
| Type | Description |
|---|---|
| CheckDigit |
Mod37Radix2
Check alphanumeric strings with one check digit or letter or the supplementary check character "*"
Declaration
public static CheckDigit Mod37Radix2 { get; }
Property Value
| Type | Description |
|---|---|
| CheckDigit |
Mod661Radix26
Check alphabetic strings with two check letters
Declaration
public static CheckDigit Mod661Radix26 { get; }
Property Value
| Type | Description |
|---|---|
| CheckDigit |
Mod97Radix10
Check numeric strings with two check digits
Declaration
public static CheckDigit Mod97Radix10 { get; }
Property Value
| Type | Description |
|---|---|
| CheckDigit |
Modulus
The modulus
Declaration
public int Modulus { get; }
Property Value
| Type | Description |
|---|---|
| int |
Radix
The radix
Declaration
public int Radix { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
View SourceAddCheckDigit(string)
Adds the check digit to the given value
Declaration
public string AddCheckDigit(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The value from which the check digit will be computed |
Returns
| Type | Description |
|---|---|
| string | The value and appended check digit |
CalculateCheckDigit(string)
Calculates the check digit from a given value
Declaration
public string CalculateCheckDigit(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The value from which the check digit will be computed |
Returns
| Type | Description |
|---|---|
| string | The check digit |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Empty value exception |
| CheckDigitCharException | Invalid character exception |
Check(string)
Checks if the given value contains a valid check digit
Declaration
public void Check(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The value to check |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Empty value exception |
| CheckDigitLengthException | Value length exception |
| CheckDigitMismatchException | Value with invalid character exception |
IsValidEan13(string)
Check EAN-13 digit
Declaration
public static bool IsValidEan13(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value |
Returns
| Type | Description |
|---|---|
| bool |
IsValidItf(string)
Check ITF digit
Declaration
public static bool IsValidItf(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value |
Returns
| Type | Description |
|---|---|
| bool |
IsValidUpcA(string)
Check UPC-A digit
Declaration
public static bool IsValidUpcA(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value |
Returns
| Type | Description |
|---|---|
| bool |