chemistry_tools.cas
Functions for working with CAS registry numbers.
Functions:
|
Converts an integer CAS registry number to a hyphenated string. |
|
Converts a hyphenated string CAS registry number to an integer. |
|
Checks the CAS registry number to ensure the check digit is valid with respect to the rest of the number. |
-
cas_string_to_int(cas_no)[source] Converts a hyphenated string CAS registry number to an integer.
- Parameters
cas_no
- Raises
ValueError – If the CAS registry number is invalid.
-
check_cas_number(cas_no)[source] Checks the CAS registry number to ensure the check digit is valid with respect to the rest of the number.
If the CAS registry number is valid
0is returned. If there is a problem the difference between the computed check digit and that given as part of the CAS registry number is returned.