MathExtensionsLunhAlgorithm Method

The Lunh algorithm is used a simple check digit formula to validate a variety of identification numbers. We use it for ImeiNumbers and SimCardNumbers.

Definition

Namespace: MobileTrack.Common.Extensions
Assembly: MobileTrack.Common (in MobileTrack.Common.dll) Version: 0.7+1dadc87dcf0a0f837e19a3ce2deb7c1cd85375d1
public static bool LunhAlgorithm(
	string input,
	ValidationModel onError,
	out ValidationModel validationModel
)

Parameters

input  String
String to check whether its last digit (check digit) pans out.
onError  ValidationModel
Validation model to return if the output is faulty.
validationModel  ValidationModel
Validation result

Return Value

Boolean
if the number was correct.

Exceptions

ArgumentExceptionThrown if input is IsNullOrEmpty(String), or if it contains anything else than digits.

See Also