- string-parse-start+end proc s argsprocedure
- string-parse-final-start+end proc s argsprocedure
string-parse-start+end may be used to parse a pair of optional START/END arguments from an argument list, defaulting them to 0 and the length of some string S, respectively. Let the length of string S be SLEN.
- If ARGS = (), the function returns (values '() 0 SLEN)
- If ARGS = (I), I is checked to ensure it is an exact integer, and that 0 <= i <= SLEN. Returns (values (cdr ARGS) I SLEN).
- If ARGS = (I J ...), I and J are checked to ensure they are exact integers, and that 0 <= I <= J <= SLEN. Returns (values (cddr ARGS) I J).
If any of the checks fail, an error condition is raised, and PROC is used as part of the error condition -- it should be the client procedure whose argument list string-parse-start+end is parsing.
string-parse-final-start+end is exactly the same, except that the ARGS list passed to it is required to be of length two or less; if it is longer, an error condition is raised. It may be used when the optional START/END parameters are final arguments to the procedure.
Note that in all cases, these functions ensure that S is a string (by necessity, since all cases apply string-length to S either to default END or to bounds-check it).