Published in Depth-First
Author Richard L. Apodaca
The Chemical Abstracts Service (CAS) registry number system was designed to be fault-tolerant. Built into every CAS number is a check-digit that makes it possible to detect mis-typed numbers. Validation is a mathematical and repetitive process well-suited for software. The Ruby program below validates arbitrary CAS numbers: module CAS def validate cas_number return false unless cas_number &&