This small application will check one or more Chemical Abstract Service (CAS) Registry Numbers to make sure they are formatted correctly. It validates both the format of the given registry numbers and also their check digits.
The command-line application takes a CAS number as a single argument, or a series of CAS numbers (one per line) from the standard input (for example piped from a text file or another application, or from the keyboard). Valid CAS numbers are printed to the standard output (for piping to a subsequent application, or redirecting to a text file) and messages are written to the standard error.
With no arguments the application reads from the standard in. This example takes the contents of the text file inputfile.txt, returning valid CAS numbers in outputfile.txt and recording the invalid CAS numbers in errorlog.txt.
This example, again with no arguments, reads a single CAS number from the standard in. If the CAS is valid it will write the CAS to the console as confirmation, if it is invalid then an error message will be displayed.
This example takes a CAS number as a single argument. If the CAS is valid it will write the CAS to the console as confirmation, if it is invalid then an error message will be displayed.
The --help argument shows brief usage information and also the version number of the application
CheckCAS should work on the following Operating systems.
- Windows 7
- Windows XP with .NET Framework 2 installed (download from Windows Update)
Download CheckCAS 1.0 for free from here
- CheckCAS_1.00.zip 6K ZIP file
UPDATE– Four years on I’ve taken this code and converted it to a PowerShell function. This is available Open Source on GitHub here: https://github.com/isjwuk/test-cas