X-Git-Url: https://git.distorted.org.uk/~mdw/lisp/blobdiff_plain/b73ffb8235ffb6f3bce6ac42731e19d3be846067..813da880d2d77f04ea623f426d543d298528f967:/str.lisp diff --git a/str.lisp b/str.lisp index 5cf05aa..aff11a8 100644 --- a/str.lisp +++ b/str.lisp @@ -1,7 +1,5 @@ ;;; -*-lisp-*- ;;; -;;; $Id$ -;;; ;;; String utilities of various kinds ;;; ;;; (c) 2005 Straylight/Edgeware @@ -24,11 +22,10 @@ ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. (defpackage #:mdw.str - (:use #:common-lisp #:mdw.base) - (:export #:join-strings #:str-next-word #:str-split-words - #:str-beginsp #:str-endsp)) + (:use #:common-lisp #:mdw.base)) (in-package #:mdw.str) +(export 'join-strings) (defun join-strings (del strs) "Join together the strings STRS with DEL between them. All the arguments are first converted to strings, as if by `stringify'. Otherwise, this is @@ -37,11 +34,12 @@ (with-output-to-string (s) (when strs (loop - (princ (stringify (pop strs)) s) + (princ (stringify (pop strs)) s) (unless strs (return)) (princ del s))))) +(export 'str-next-word) (defun str-next-word (string &key quotedp start end) "Extract a whitespace-delimited word from STRING, returning it and the index to continue parsing from. If no word is found, return nil twice. @@ -108,6 +106,7 @@ :initial-contents w) i))) +(export 'str-split-words) (defun str-split-words (string &key quotedp start end max) "Break STRING into words, like str-next-word does, returning the list of the individual words. If QUOTEDP, then allow quoting and backslashifying; @@ -135,6 +134,7 @@ (incf n))) (nreverse l))) +(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 @@ -148,6 +148,7 @@ :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