4 stable releases
1.0.3 | Apr 22, 2024 |
---|
#1388 in Parser implementations
32 downloads per month
12KB
150 lines
Spreadsheet addresses
Convert spreadsheet addresses to coordinates and vice versa in a fully tested and documented way!
Are you working on a spreadsheet application or something of the sort? What, you are not sure how to implement these address names? No worries - i have got you covered!
Examples
Convert from addresses to structs...
use spreadsheet_addresses::{Coordinate, AddressParsingError};
let coordinate1 = Coordinate::from_address("$CV23");
let coordinate2 = Coordinate::from_address("Hello World");
assert_eq!(
coordinate1,
Ok(Coordinate {
row: 22,
column: 99,
relative_row: true,
relative_column: false,
})
);
assert_eq!(
coordinate2,
Err(AddressParsingError {
input: "Hello World".to_string()
})
);
...or the other way around!
use spreadsheet_addresses::Coordinate;
let coordinate = Coordinate::new(22, 99, true, false);
let address = coordinate.to_address();
assert_eq!(
address,
"$CV23".to_string()
);
Dependencies
~1MB
~19K SLoC