#string-representation #convert-string #chemical #symbols #parser #element #notation

chemstring

A parser that converts strings to their representation using chemical element notations

1 unstable release

0.1.0 Feb 5, 2024

#382 in Science

MIT license

9KB
113 lines

ChemString

CI

ChemString provides a parser that allows you to convert a string to its representation(s) using chemical symbols.

Examples

   use chemstring::ChemString;

   let chem_string = ChemString::parse("seal").unwrap();
   assert_eq!(chem_string, vec!["Se", "Al"]);

   let chem_string = ChemString::parse("bichon").unwrap();
   let possible_permutation = "Bi C H O N".to_string();
    assert!(chem_string.results().contains(&possible_permutation));

License

This project is licensed under the MIT license.


lib.rs:

A library for parsing strings into chemical symbols permutations.

Example

use chemstring::ChemString;

let chem_string = ChemString::parse("seal").unwrap();
assert_eq!(chem_string.results(), vec!["Se Al"]);

let chem_string = ChemString::parse("bichon").unwrap();
let possible_permutation = "Bi C H O N".to_string();
assert!(chem_string.results().contains(&possible_permutation));

Dependencies

~330–790KB
~19K SLoC