... |
... |
@@ -676,49 +676,6 @@ |
676
|
676
|
(setf (schar newstring new-index) (schar string index)))
|
677
|
677
|
newstring))))
|
678
|
678
|
|
679
|
|
-#+nil
|
680
|
|
-(defun string-capitalize (string &key (start 0) end)
|
681
|
|
- _N"Given a string, returns a copy of the string with the first
|
682
|
|
- character of each ``word'' converted to upper-case, and remaining
|
683
|
|
- chars in the word converted to lower case. A ``word'' is defined
|
684
|
|
- to be a string of case-modifiable characters delimited by
|
685
|
|
- non-case-modifiable chars."
|
686
|
|
- (declare (fixnum start))
|
687
|
|
- (let* ((string (if (stringp string) string (string string)))
|
688
|
|
- (slen (length string)))
|
689
|
|
- (declare (fixnum slen))
|
690
|
|
- (with-one-string string start end offset
|
691
|
|
- (let ((offset-slen (+ slen offset))
|
692
|
|
- (newstring (make-string slen)))
|
693
|
|
- (declare (fixnum offset-slen))
|
694
|
|
- (do ((index offset (1+ index))
|
695
|
|
- (new-index 0 (1+ new-index)))
|
696
|
|
- ((= index start))
|
697
|
|
- (declare (fixnum index new-index))
|
698
|
|
- (setf (schar newstring new-index) (schar string index)))
|
699
|
|
- (do ((index start (1+ index))
|
700
|
|
- (new-index (- start offset) (1+ new-index))
|
701
|
|
- (newword t)
|
702
|
|
- (char ()))
|
703
|
|
- ((= index (the fixnum end)))
|
704
|
|
- (declare (fixnum index new-index))
|
705
|
|
- (setq char (schar string index))
|
706
|
|
- (cond ((not (alphanumericp char))
|
707
|
|
- (setq newword t))
|
708
|
|
- (newword
|
709
|
|
- ;;char is first case-modifiable after non-case-modifiable
|
710
|
|
- (setq char (char-upcase char))
|
711
|
|
- (setq newword ()))
|
712
|
|
- ;;char is case-modifiable, but not first
|
713
|
|
- (t (setq char (char-downcase char))))
|
714
|
|
- (setf (schar newstring new-index) char))
|
715
|
|
- (do ((index end (1+ index))
|
716
|
|
- (new-index (- (the fixnum end) offset) (1+ new-index)))
|
717
|
|
- ((= index offset-slen))
|
718
|
|
- (declare (fixnum index new-index))
|
719
|
|
- (setf (schar newstring new-index) (schar string index)))
|
720
|
|
- newstring))))
|
721
|
|
-
|
722
|
679
|
(defun string-capitalize (string &key (start 0) end)
|
723
|
680
|
_N"Given a string, returns a copy of the string with the first
|
724
|
681
|
character of each ``word'' converted to upper-case, and remaining
|
... |
... |
@@ -787,32 +744,6 @@ |
787
|
744
|
(char-downcase (schar string index)))))
|
788
|
745
|
save-header))
|
789
|
746
|
|
790
|
|
-#+nil
|
791
|
|
-(defun nstring-capitalize (string &key (start 0) end)
|
792
|
|
- "Given a string, returns that string with the first
|
793
|
|
- character of each ``word'' converted to upper-case, and remaining
|
794
|
|
- chars in the word converted to lower case. A ``word'' is defined
|
795
|
|
- to be a string of case-modifiable characters delimited by
|
796
|
|
- non-case-modifiable chars."
|
797
|
|
- (declare (fixnum start))
|
798
|
|
- (let ((save-header string))
|
799
|
|
- (with-one-string string start end offset
|
800
|
|
- (do ((index start (1+ index))
|
801
|
|
- (newword t)
|
802
|
|
- (char ()))
|
803
|
|
- ((= index (the fixnum end)))
|
804
|
|
- (declare (fixnum index))
|
805
|
|
- (setq char (schar string index))
|
806
|
|
- (cond ((not (alphanumericp char))
|
807
|
|
- (setq newword t))
|
808
|
|
- (newword
|
809
|
|
- ;;char is first case-modifiable after non-case-modifiable
|
810
|
|
- (setf (schar string index) (char-titlecase char))
|
811
|
|
- (setq newword ()))
|
812
|
|
- (t
|
813
|
|
- (setf (schar string index) (char-downcase char))))))
|
814
|
|
- save-header))
|
815
|
|
-
|
816
|
747
|
(defun nstring-capitalize (string &key (start 0) end)
|
817
|
748
|
_N"Given a string, returns that string with the first
|
818
|
749
|
character of each ``word'' converted to upper-case, and remaining
|