Initial Comit
This commit is contained in:
30
Helper/helper.cs
Normal file
30
Helper/helper.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Helper
|
||||
{
|
||||
public static class DivFnkt
|
||||
{
|
||||
public static int modulo10(string nummer)
|
||||
{
|
||||
// 'nummer' darf nur Ziffern zwischen 0 und 9 enthalten!
|
||||
|
||||
int[] tabelle = { 0, 9, 4, 6, 8, 2, 7, 1, 3, 5 };
|
||||
int uebertrag = 0;
|
||||
|
||||
foreach (char ziffer in nummer)
|
||||
uebertrag = tabelle[(uebertrag + ziffer - '0') % 10];
|
||||
|
||||
return (10 - uebertrag) % 10;
|
||||
}
|
||||
|
||||
public static bool IsNumeric(string value)
|
||||
{
|
||||
return value.All(char.IsNumber);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user