changed defsetf entry
[clqr.git] / clqr-strings.tex
bloba3f3e24f8df2a0ea755ff350c10dd56f4b996638
1 % Copyright (C) 2008 Bert Burgemeister
3 % Permission is granted to copy, distribute and/or modify this
4 % document under the terms of the GNU Free Documentation License,
5 % Version 1.2 or any later version published by the Free Software
6 % Foundation; with no Invariant Sections, no Front-Cover Texts and
7 % no Back-Cover Texts. For details see file COPYING.
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 \section{Strings}
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 Strings can as well be manipulated by array and sequence functions,
14 see pages \pageref{section:Arrays} and \pageref{section:Sequences}.
16 \begin{LIST}{1cm}
19 \IT{\arrGOO{(\FU*{STRINGP} \VAR{ foo})\\
20 (\FU*{SIMPLE-STRING-P} \VAR{ foo})}{.}}
22 Return \retval{\T} if \VAR{foo} is of type
23 \kwd{string} or \kwd{simple-string}, respectively.
26 \IT{(\xorGOO{\FU*{STRING=}\\\FU*{STRING-EQUAL}}{\}} \VAR{foo}
27 \VAR{bar}
28 \orGOO{\kwd{:start1} \VAR{ start-foo}\DF{\LIT{0}}\\
29 \kwd{:start2} \VAR{ start-bar}\DF{\LIT{0}}\\
30 \kwd{:end1} \VAR{ end-foo}\DF{\NIL}\\
31 \kwd{:end2} \VAR{ end-bar}\DF{\NIL}}{\}})}
33 Return \retval{\T} if
34 subsequences of \VAR{foo} and \VAR{bar} are equal. Obey/ignore,
35 respectively, case.
38 \IT{(\xorGOO{\FU*{STRING/=}\\\FU{STRING\boldmath$>$}\\
39 \FU{STRING\boldmath$>=$}\\\FU{STRING\boldmath$<$}\\
40 \FU{STRING\boldmath$<=$}}{\}} \VAR{foo} \VAR{bar}
41 \orGOO{\kwd{:start1} \VAR{ start-foo}\DF{\LIT{0}}\\
42 \kwd{:start2} \VAR{ start-bar}\DF{\LIT{0}}\\
43 \kwd{:end1} \VAR{ end-foo}\DF{\NIL}\\
44 \kwd{:end2} \VAR{ end-bar}\DF{\NIL}}{\}})}
46 \index{string>@STRING$>$}%
47 \index{string>=@STRING$>=$}%
48 \index{string<@STRING$<$}%
49 \index{string<=@STRING$<=$}%
50 If \VAR{foo} is
51 lexicographically not equal, greater, not less, less, or not greater,
52 respectively, then return \retval{character number} from beginning of \VAR{foo}
53 where they begin to differ. Otherwise return \retval{\NIL}.
56 \IT{(\xorGOO{\FU*{STRING-NOT-EQUAL}\\
57 \FU*{STRING-GREATERP}\\
58 \FU*{STRING-NOT-LESSP}\\
59 \FU*{STRING-LESSP}\\
60 \FU*{STRING-NOT-GREATERP}}{\}}
61 \VAR{foo} \VAR{bar}
62 \orGOO{%
63 \kwd{:start1} \VAR{ start-foo}\DF{\LIT{0}}\\
64 \kwd{:start2} \VAR{ start-bar}\DF{\LIT{0}}\\
65 \kwd{:end1} \VAR{ end-foo}\DF{\NIL}\\
66 \kwd{:end2} \VAR{ end-bar}\DF{\NIL}}{\}})}
68 If \VAR{foo} is
69 lexicographically not equal, greater, not less, less, or not greater,
70 respectively, ignoring case, then return \retval{character number} from beginning of \VAR{foo}
71 where they begin to differ. Otherwise return \retval{\NIL}.
74 \IT{(\FU*{STRING} \VAR{x})}
76 Convert \VAR{x} (\kwd{symbol}, \kwd{string}, or \kwd{character})
77 into a \retval{string}.
80 \IT{(\FU*{MAKE-STRING} \VAR{size} \orGOO{\kwd{:initial-element} \VAR{ char}\\
81 \kwd{:element-type} \VAR{ type}\DF{\kwd{character}}}{\}})}
83 Return \retval{string} of length \VAR{size}.
86 \IT{(\xorGOO{\FU{STRING}\\
87 \FU{NSTRING}}{\}}\kwd{-}\xorGOO{\kwd{CAPITALIZE}\\
88 \kwd{UPCASE}\\
89 \kwd{DOWNCASE}}{\}}
90 \VAR{string}
91 \orGOO{\kwd{:start} \VAR{ start}\DF{\LIT{0}}\\
92 \kwd{:end} \VAR{ end}\DF{\NIL}}{\}})}
94 \index{STRING-CAPITALIZE}%
95 \index{STRING-UPCASE}%
96 \index{STRING-DOWNCASE}%
97 \index{NSTRING-CAPITALIZE}%
98 \index{NSTRING-UPCASE}%
99 \index{NSTRING-DOWNCASE}%
100 Return \retval{\VAR{string}} (not modified or modified, respectively) with
101 first letter of every word turned into uppercase, letters all
102 uppercase, or letters all lowercase, respectively.
105 \IT{(\xorGOO{\FU*{STRING-TRIM}\\
106 \FU*{STRING-LEFT-TRIM}\\
107 \FU*{STRING-RIGHT-TRIM}}{\}} \VAR{char-bag} \VAR{string})}
109 Return \retval{\VAR{string}} with all characters in sequence \VAR{char-bag} removed
110 from both ends, from the beginning, or from the end, respectively.
113 \IT{\arrGOO{(\FU*{CHAR} \VAR{ string} \VAR{ i})\\
114 (\FU*{SCHAR} \VAR{ string} \VAR{ i})}{.}}
116 Return zero-indexed \retval{\VAR{i}th character} of string ignoring/obeying,
117 respectively, fill pointer. \kwd{setf}able.
120 \IT{(\FU*{PARSE-INTEGER} \VAR{string}
121 \orGOO{\kwd{:start} \VAR{ start}\DF{\LIT{0}}\\
122 \kwd{:end} \VAR{ end}\DF{\NIL}\\
123 \kwd{:radix} \VAR{ int}\DF{\LIT{10}}\\
124 \kwd{:junk-allowed} \VAR{ bool}\DF{\NIL}}{\}})}
126 Parse \retval{integer} from \VAR{string}. Second value is
127 \retvalii{index} of parse end in \VAR{string}.
132 \end{LIST}