Common Lisp Package: PARSE-FLOAT

README:

FUNCTION

Public

PARSE-FLOAT (STRING &KEY (START 0) (END NIL) (RADIX 10) (JUNK-ALLOWED NIL) (DECIMAL-CHARACTER .) (EXPONENT-CHARACTER e) (TYPE *READ-DEFAULT-FLOAT-FORMAT*))

Similar to PARSE-INTEGER, but parses a floating point value and returns the value as the specified TYPE (by default *READ-DEFAULT-FLOAT-FORMAT*). The DECIMAL-CHARACTER (by default #.) specifies the separator between the integer and decimal parts, and the EXPONENT-CHARACTER (by default #e, case insensitive) specifies the character before the exponent. Note that the exponent is only parsed if RADIX is 10.

Private

PARSE-INTEGER-ONLY (STRING &KEY (START 0) (END NIL) (RADIX 10) (ALLOW-SIGN T))

Parse an integer from a string, without skipping whitespaces. Returns three values: the integer, the position in the string that ended the parsing, and a boolean which is T if the parsing ended due to a whitespace or end of the string, and NIL otherwise. If allow-sign is NIL (T by default), also signs are not allowed in the string (i.e. cannot start with #+ or #-).

SIGN-CHAR-P (CHARACTER)

Predicate for testing if CHARACTER is a sign character (i.e. #+ or #-).

SKIP-WHITESPACES (STRING &KEY FROM-END (START 0) END)

For the substring in STRING delimited by START and END, skip all the whitespace at the beginning and return the index of the first non-whitespace character, or END if no non-whitespace characters were found. If FROM-END is T, then the search is reversed, skipping all the whitespace at the end and returning the index of the last whitespace character from END, or START if no non-whitespace characters were found.

WHITESPACE-CHAR-P (CHARACTER)

Predicate for testing if CHARACTER is a whitespace character.

VARIABLE

Private

*WHITESPACE-CHARACTERS*

List of whitespace characters