Return to Snippet

Revision: 5216
at February 19, 2008 21:50 by jmaddalone


Updated Code
Public Function isbn13toisbn10(ByVal isbn13)
        Dim a As Integer
        Dim b As Integer
        Dim c As Integer
        Dim d As Integer
        Dim e As Integer
        Dim f As Integer
        Dim g As Integer
        Dim h As Integer
        Dim i As Integer
        Dim j As Integer
        Dim k As Integer
        Dim l As Integer
        Dim m As Integer
        Dim n As Integer
        Dim o As Object
        Dim n2 As Integer
        Dim isbnarr(12)
        For i = 0 To 12
            isbnarr(i) = CInt(Mid(isbn13, i + 1, 1))
        Next
        a = isbnarr(0)
        b = isbnarr(1)
        c = isbnarr(2)
        d = isbnarr(3)
        e = isbnarr(4)
        f = isbnarr(5)
        g = isbnarr(6)
        h = isbnarr(7)
        i = isbnarr(8)
        j = isbnarr(9)
        k = isbnarr(10)
        l = isbnarr(11)
        m = isbnarr(12)
        n = (d * 10) + (9 * e) + (8 * f) + (7 * g) + (6 * h) + (5 * i) + (4 * j) + (3 * k) + (2 * l)
        n2 = Int((n / 11) + 1)
        o = (11 * n2) - n
        If o = 10 Then
            o = "X"
        ElseIf o = 11 Then
            o = 0
        End If
        isbn13toisbn10 = CStr(d & e & f & g & h & i & j & k & l & o)
    End Function

Revision: 5215
at February 19, 2008 21:46 by jmaddalone


Initial Code
Public Function isbn13toisbn10(ByVal isbn13)
        Dim a As Integer
        Dim b As Integer
        Dim c As Integer
        Dim d As Integer
        Dim e As Integer
        Dim f As Integer
        Dim g As Integer
        Dim h As Integer
        Dim i As Integer
        Dim j As Integer
        Dim k As Integer
        Dim l As Integer
        Dim m As Integer
        Dim n As Integer
        Dim o As Object
        Dim n2 As Integer
        Dim isbnarr(12)
        For i = 0 To 12
            isbnarR(i) = CInt(Mid(isbn13, i + 1, 1))
        Next
        a = isbnarR(0)
        b = isbnarR(1)
        c = isbnarR(2)
        d = isbnarR(3)
        e = isbnarR(4)
        f = isbnarR(5)
        g = isbnarR(6)
        h = isbnarR(7)
        i = isbnarR(8)
        j = isbnarR(9)
        k = isbnarR(10)
        l = isbnarR(11)
        m = isbnarR(12)
        n = (d * 10) + (9 * e) + (8 * f) + (7 * g) + (6 * h) + (5 * i) + (4 * j) + (3 * k) + (2 * l)
        n2 = Int((n / 11) + 1)
        o = (11 * n2) - n
        If o = 10 Then
            o = "X"
        ElseIf o = 11 Then
            o = 0
        End If
        isbn13toisbn10 = CStr(d & e & f & g & h & i & j & k & l & o)
    End Function

Initial URL
http://labs.insert-title.com

Initial Description


Initial Title
Convert ISBN 13 to 10

Initial Tags


Initial Language
VB.NET