diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/klatre/klatre.lisp | 6 | ||||
-rw-r--r-- | lisp/klatre/package.lisp | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lisp/klatre/klatre.lisp b/lisp/klatre/klatre.lisp index b20d1ab5282a..50cc510502e8 100644 --- a/lisp/klatre/klatre.lisp +++ b/lisp/klatre/klatre.lisp @@ -88,3 +88,9 @@ separated by SEP." (comment (format-dottime (local-time:now))) + +(defun try-parse-integer (str) + "Attempt to parse STR as an integer, returning nil if it is invalid." + (check-type str string) + (handler-case (parse-integer str) + (sb-int:simple-parse-error (_) nil))) diff --git a/lisp/klatre/package.lisp b/lisp/klatre/package.lisp index b5f574fa16c6..2e6340167909 100644 --- a/lisp/klatre/package.lisp +++ b/lisp/klatre/package.lisp @@ -9,4 +9,5 @@ #:chunk-list #:mapconcat ;; String handling - #:+dottime-format+ #:format-dottime)) + #:+dottime-format+ #:format-dottime + #:try-parse-integer)) |