branch: elpa/csv2ledger
commit e4a823e55282d6f0a632f7aeaee7fa8648d124f2
Author: Joost Kremers <joostkrem...@fastmail.fm>
Commit: Joost Kremers <joostkrem...@fastmail.fm>

    Add helper function c2l--amount-p.
---
 csv2ledger.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/csv2ledger.el b/csv2ledger.el
index 1aa3189759..b007b4b450 100644
--- a/csv2ledger.el
+++ b/csv2ledger.el
@@ -254,6 +254,12 @@ make sure to add one using `c2l-field-parse-functions'."
       "0.00"))
 
 (defun c2l--compose-entry (items &optional from to)
+;;; Helper functions
+
+(defun c2l--amount-p (str)
+  "Return non-nil is STR is likely to be an amount."
+  (string-match-p "[0-9]+[0-9.,]*[.,][0-9]\\{2\\}" str))
+
   "Create a ledger entry.
 ITEMS is an alist containing (key . value) pairs that should be
 included in the entry.  It should contain values for the keys

Reply via email to