tracks/julia/exercises/isbn-verifier/example.jl in trackler-2.2.1.106 vs tracks/julia/exercises/isbn-verifier/example.jl in trackler-2.2.1.107
- old
+ new
@@ -6,9 +6,11 @@
s::AbstractString
ISBN(s) = verify(s) ? new(replace(s, "-", "")) : throw(ArgumentError("invalid ISBN string: $s"))
end
+string(s::ISBN) = s.s
+
function verify(s::AbstractString)
s = replace(s, "-", "")
chars = split(s, "")
length(chars) == 10 || return false