Skip to content

Commit

Permalink
Use casecmp instead of downcase
Browse files Browse the repository at this point in the history
  • Loading branch information
JPrevost committed Jan 14, 2025
1 parent 2e4986c commit 1f8d59c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/detector/standard_identifiers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def valid_isbn?(candidate)
def valid_isbn_10?(digits)
sum = 0
digits.each_with_index do |digit, index|
digit = '10' if digit.downcase == 'x'
digit = '10' if digit.casecmp('x').zero?
sum += digit.to_i * (10 - index)
end
(sum % 11).zero?
Expand Down

0 comments on commit 1f8d59c

Please sign in to comment.