(setf (schar string i) fill-char))
(make-string count)))
-(flet ((frob (string start end)
- (declare (string string) (index start) (type (or index null end)))
- (let ((save-header string))
+(flet ((%upcase (string start end)
+ (declare (string string) (index start) (type sequence-end end))
+ (let ((saved-header string))
(with-one-string (string start end)
(do ((index start (1+ index)))
((= index (the fixnum end)))
(declare (fixnum index))
(setf (schar string index) (char-upcase (schar string index)))))
- save-header)))
+ saved-header)))
(defun string-upcase (string &key (start 0) end)
- (frob (copy-seq string) start end))
+ (%upcase (copy-seq (string string)) start end))
(defun nstring-upcase (string &key (start 0) end)
- (frob string start end))
+ (%upcase string start end))
) ; FLET
-(flet ((frob (string start end)
- (declare (string string) (index start) (type (or index null end)))
- (let ((save-header string))
+(flet ((%downcase (string start end)
+ (declare (string string) (index start) (type sequence-end end))
+ (let ((saved-header string))
(with-one-string (string start end)
(do ((index start (1+ index)))
((= index (the fixnum end)))
(declare (fixnum index))
(setf (schar string index)
(char-downcase (schar string index)))))
- save-header)))
+ saved-header)))
(defun string-downcase (string &key (start 0) end)
- (frob (copy-seq string) start end))
+ (%downcase (copy-seq (string string)) start end))
(defun nstring-downcase (string &key (start 0) end)
- (frob string start end))
+ (%downcase string start end))
) ; FLET
-(flet ((frob (string start end)
- (declare (string string) (index start) (type (or index null end)))
- (let ((save-header string))
+(flet ((%capitalize (string start end)
+ (declare (string string) (index start) (type sequence-end end))
+ (let ((saved-header string))
(with-one-string (string start end)
(do ((index start (1+ index))
- (newword t)
- (char ()))
+ (new-word? t)
+ (char nil))
((= index (the fixnum end)))
(declare (fixnum index))
(setq char (schar string index))
(cond ((not (alphanumericp char))
- (setq newword t))
- (newword
- ;; CHAR is the first case-modifiable character after
- ;; a sequence of non-case-modifiable characters.
- (setf (schar string index) (char-upcase char))
- (setq newword ()))
- (t
- (setf (schar string index) (char-downcase char))))))
- save-header)))
+ (setq new-word? t))
+ (new-word?
+ ;; CHAR is the first case-modifiable character after
+ ;; a sequence of non-case-modifiable characters.
+ (setf (schar string index) (char-upcase char))
+ (setq new-word? nil))
+ (t
+ (setf (schar string index) (char-downcase char))))))
+ saved-header)))
(defun string-capitalize (string &key (start 0) end)
- (frob (copy-seq string) start end))
+ (%capitalize (copy-seq (string string)) start end))
(defun nstring-capitalize (string &key (start 0) end)
- (frob string start end))
+ (%capitalize string start end))
) ; FLET
(defun string-left-trim (char-bag string)