#iso-4217 #money #currency

liquidity_check

Validate if a string represents a monetary value

1 unstable release

0.1.0 Jan 17, 2023

#228 in Finance

22 downloads per month

MIT license

7KB
89 lines

Liquidity Check

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);

Note

The current implementation is quite simple, so in some edge cases it's possible to get false positives.

Dependencies

~1MB
~16K SLoC