Berechnung der Prüfziffer nach Modulo9/Rekursiv

 
Assembly: EDKB12WS (in EDKB12WS.exe)

Syntax

Visual Basic

Public Function Pruefziffer( _
   ByVal zahl As String _
) As String

C#

public string Pruefziffer(
   stringzahl
)

C++

public: 
String^ Pruefziffer(
   Stringzahl

JScript

public function Pruefziffer(
    zahl : String
) : String;

Parameters

zahl

Dokumentid ohne Präfix

 

 

Return Value

DokumentID ohne Präfix (OFFEDK) inkl. Prüfziffer

 

Source code

Visual Basic

 Public Function Pruefziffer(ByVal zahl As String) As String
    Dim ptab(9, 9) As Integer
    Dim pz(9) As Integer
    Dim s1, s2, s3 As String
 
    Dim i1, i2 As Long
 
    s1 = "0,9,4,6,8,2,7,1,3,5"
    s2 = s1
    For i1 = 0 To 9
        For i2 = 0 To 9
            ptab(i1, i2) = Mid(s2, (i2 * 2) + 1, 1)
        Next
        s3 = Microsoft.VisualBasic.Left(s1, 1)
        s1 = Microsoft.VisualBasic.Right(s1, Len(s1) - 2)
        s1 = s1 + "," + s3
        s2 = s1
    Next
    pz(0) = 0
    pz(1) = 9
    pz(2) = 8
    pz(3) = 7
    pz(4) = 6
    pz(5) = 5
    pz(6) = 4
    pz(7) = 3
    pz(8) = 2
    pz(9) = 1
 
    Dim i, x, y As Integer
    y = 0
    For i = 1 To Len(zahl)
        x = Val(Mid(zahl, i, 1))
        y = ptab(x, y)
    Next
    Pruefziffer = Str(pz(y))
 End Function 

Platforms

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

 

Version Information

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0
 

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0
 

XNA Framework

Supported in: 3.0, 2.0, 1.0
 

 

See Also