Jump to content

ISBN13 check digit: Difference between revisions

(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
Line 2,564:
</pre>
 
=={{header|RPL}}==
{{works with|Halcyon Calc|4.2.7}}
≪ → isbn
≪ 0 1 CF
1 isbn SIZE FOR j
IF "0123456789" isbn j DUP SUB POS THEN
LAST 1 -
IF 1 FS?C THEN 3 * ELSE 1 SF END
+
END
NEXT
10 MOD NOT
'ISBN?' STO
 
≪ { "978-0596528126" "978-0596528120" "978-1788399081" "978-1788399083" } → tests
≪ 1 tests SIZE FOR j tests GET ISBN? NEXT ≫
≫ EVAL
{{out}}
<pre>
4: 1
3: 0
2: 1
1: 0
</pre>
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">def validISBN13?(str)
1,150

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.