Crates.io | liquidity_check |
lib.rs | liquidity_check |
version | 0.1.0 |
source | src |
created_at | 2023-01-17 18:18:08.576014 |
updated_at | 2023-01-17 18:18:08.576014 |
description | Validate if a string represents a monetary value |
homepage | https://github.com/b3nj5m1n/liquidity_check |
repository | https://github.com/b3nj5m1n/liquidity_check |
max_upload_size | |
id | 761153 |
size | 8,030 |
A rust library for checking if a string represents a valid monetary value.
assert_eq!(validate("$50"), true);
assert_eq!(validate("€ 50"), true);
assert_eq!(validate("50 EUR"), true);
assert_eq!(validate("50.0 ¥"), true);
assert_eq!(validate("50"), false);
assert_eq!(validate("50 ER"), false);
assert_eq!(validate("50_$"), false);
assert_eq!(validate("50,000 PAB"), true);
The current implementation is quite simple, so in some edge cases it's possible to get false positives.