Show / Hide Table of Contents

Class CheckDigit

Compute and validate text value digits (ISO 7064 compatible)

Inheritance
object
CheckDigit
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
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 Source

CheckDigit(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 Source

CharacterSet

The supported character set

Declaration
public string CharacterSet { get; }
Property Value
Type Description
string
View Source

DoubleCheckDigit

Double check digit

Declaration
public bool DoubleCheckDigit { get; }
Property Value
Type Description
bool
View Source

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
View Source

Mod1271Radix36

Check alphabetic strings with two check letters

Declaration
public static CheckDigit Mod1271Radix36 { get; }
Property Value
Type Description
CheckDigit
View Source

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
View Source

Mod661Radix26

Check alphabetic strings with two check letters

Declaration
public static CheckDigit Mod661Radix26 { get; }
Property Value
Type Description
CheckDigit
View Source

Mod97Radix10

Check numeric strings with two check digits

Declaration
public static CheckDigit Mod97Radix10 { get; }
Property Value
Type Description
CheckDigit
View Source

Modulus

The modulus

Declaration
public int Modulus { get; }
Property Value
Type Description
int
View Source

Radix

The radix

Declaration
public int Radix { get; }
Property Value
Type Description
int

Methods

View Source

AddCheckDigit(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

View Source

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

View Source

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

View Source

IsValidEan13(string)

Check EAN-13 digit

Declaration
public static bool IsValidEan13(string value)
Parameters
Type Name Description
string value
Returns
Type Description
bool
View Source

IsValidItf(string)

Check ITF digit

Declaration
public static bool IsValidItf(string value)
Parameters
Type Name Description
string value
Returns
Type Description
bool
View Source

IsValidUpcA(string)

Check UPC-A digit

Declaration
public static bool IsValidUpcA(string value)
Parameters
Type Name Description
string value
Returns
Type Description
bool

Extension Methods

ConsoleExtensions.WriteProperties(object, bool)
ValueTypeExtensions.GetValueType(object)
ObjectInfo.GetPropertyValue(object, string)
ObjectInfo.GetPropertyValue<T>(object, string, T)
ObjectInfo.ResolvePropertyValue(object, string)
ObjectInfo.SetPropertyValue(object, string, object)
  • View Source
☀
☾
Back to top Generated by DocFX