Convert ISBN 13 to 10


/ Published in: VB.NET
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Public Function isbn13toisbn10(ByVal isbn13)
  2. Dim a As Integer
  3. Dim b As Integer
  4. Dim c As Integer
  5. Dim d As Integer
  6. Dim e As Integer
  7. Dim f As Integer
  8. Dim g As Integer
  9. Dim h As Integer
  10. Dim i As Integer
  11. Dim j As Integer
  12. Dim k As Integer
  13. Dim l As Integer
  14. Dim m As Integer
  15. Dim n As Integer
  16. Dim o As Object
  17. Dim n2 As Integer
  18. Dim isbnarr(12)
  19. For i = 0 To 12
  20. isbnarr(i) = CInt(Mid(isbn13, i + 1, 1))
  21. Next
  22. a = isbnarr(0)
  23. b = isbnarr(1)
  24. c = isbnarr(2)
  25. d = isbnarr(3)
  26. e = isbnarr(4)
  27. f = isbnarr(5)
  28. g = isbnarr(6)
  29. h = isbnarr(7)
  30. i = isbnarr(8)
  31. j = isbnarr(9)
  32. k = isbnarr(10)
  33. l = isbnarr(11)
  34. m = isbnarr(12)
  35. n = (d * 10) + (9 * e) + (8 * f) + (7 * g) + (6 * h) + (5 * i) + (4 * j) + (3 * k) + (2 * l)
  36. n2 = Int((n / 11) + 1)
  37. o = (11 * n2) - n
  38. If o = 10 Then
  39. o = "X"
  40. ElseIf o = 11 Then
  41. o = 0
  42. End If
  43. isbn13toisbn10 = CStr(d & e & f & g & h & i & j & k & l & o)
  44. End Function

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.