From: Alfredo Beaumont Date: Wed, 24 Apr 2013 14:41:25 +0000 (+0200) Subject: !parse-integer: handle leading whitespace X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=794047b219bd704e20ac5e4017ffab20c7c91760;p=jscl.git !parse-integer: handle leading whitespace --- diff --git a/ecmalisp.lisp b/ecmalisp.lisp index cd93750..f70407f 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -1135,7 +1135,11 @@ (index 0) (size (length string)) (sign 1)) - (when (zerop size) (return (values nil 0))) + ;; Leading whitespace + (while (and (< index size) + (whitespacep (char string index))) + (incf index)) + (unless (< index size) (return (values nil 0))) ;; Optional sign (case (char string 0) (#\+ (incf index))