+(export 'str-beginsp)
+(declaim (inline str-beginsp))
+(defun str-beginsp (string prefix &key (start1 0) end1 (start2 0) end2)
+ "Returns true if STRING (or the appropriate substring of it) begins with
+ PREFIX."
+ (setf-default end1 (length string)
+ end2 (length prefix))
+ (let ((strlen (- end1 start1))
+ (prelen (- end2 start2)))
+ (and (>= strlen prelen)
+ (string= string prefix
+ :start1 start1 :end1 (+ start1 prelen)
+ :start2 start2 :end2 end2))))
+
+(export 'str-endsp)
+(declaim (inline str-endsp))
+(defun str-endsp (string suffix &key (start1 0) end1 (start2 0) end2)
+ "Returns true if STRING (or the appropriate substring of it) ends with
+ SUFFIX."
+ (setf-default end1 (length string)
+ end2 (length suffix))
+ (let ((strlen (- end1 start1))
+ (suflen (- end2 start2)))
+ (and (>= strlen suflen)
+ (string= string suffix
+ :start1 (- end1 suflen) :end1 end1
+ :start2 start2 :end2 end2))))
+