Update README
[clqr.git] / clqr-strings.tex
blob90041276d1ab1682fe5c51df890939c39830cde4
1 % Copyright (C) 2008, 2010 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 \retval{\T} if \VAR{foo} is of indicated type.
25 \IT{(\xorGOO{\FU*{STRING=}\\\FU*{STRING-EQUAL}}{\}} \VAR{foo}
26 \VAR{bar}
27 \orGOO{\kwd{:start1} \VAR{ start-foo}\DF{\LIT{0}}\\
28 \kwd{:start2} \VAR{ start-bar}\DF{\LIT{0}}\\
29 \kwd{:end1} \VAR{ end-foo}\DF{\NIL}\\
30 \kwd{:end2} \VAR{ end-bar}\DF{\NIL}}{\}})}
32 Return \retval{\T} if subsequences of \VAR{foo} and \VAR{bar} are
33 equal. Obey/ignore, respectively, case.
36 \IT{(\xorGOO{%
37 \FU{STRING}\Goo{\kwd{/= }\XOR\kwd{-NOT-EQUAL}}\\
38 \FU{STRING}\Goo{\kwd{\boldmath$>$ }\XOR\kwd{-GREATERP}}\\
39 \FU{STRING}\Goo{\kwd{\boldmath$>$= }\XOR\kwd{-NOT-LESSP}}\\
40 \FU{STRING}\Goo{\kwd{\boldmath$<$ }\XOR\kwd{-LESSP}}\\
41 \FU{STRING}\Goo{\kwd{\boldmath$<$= }\XOR\kwd{-NOT-GREATERP}}}{\}}
42 \VAR{foo} \VAR{bar}
43 \orGOO{\kwd{:start1} \VAR{ start-foo}\DF{\LIT{0}}\\
44 \kwd{:start2} \VAR{ start-bar}\DF{\LIT{0}}\\
45 \kwd{:end1} \VAR{ end-foo}\DF{\NIL}\\
46 \kwd{:end2} \VAR{ end-bar}\DF{\NIL}}{\}})}
47 {\index{STRING/=}\index{STRING-NOT-EQUAL}%
48 \index{STRING>@STRING$>$}\index{STRING-GREATERP}%
49 \index{STRING>=@STRING$>$=}\index{STRING-NOT-LESSP}%
50 \index{STRING<@STRING$<$}\index{STRING-LESSP}%
51 \index{STRING<=@STRING$<$=}\index{STRING-NOT-GREATERP}%
52 If \VAR{foo} is lexicographically not equal, greater, not less,
53 less, or not greater, respectively, then return \retval{position}
54 of first mismatching character in \VAR{foo}. Otherwise return
55 \retval{\NIL}. Obey/ignore, respectively, case.
58 \IT{(\FU*{MAKE-STRING} \VAR{size} \orGOO{\kwd{:initial-element} \VAR{ char}\\
59 \kwd{:element-type} \VAR{ type}\DF{\kwd{character}}}{\}})}
61 Return \retval{string} of length \VAR{size}.
64 \IT{\arrGOO{%
65 (\FU*{STRING} \VAR{ x})\\
66 (\xorGOO{%
67 \FU*{STRING-CAPITALIZE}\\
68 \FU*{STRING-UPCASE}\\
69 \FU*{STRING-DOWNCASE}}{\}}
70 \VAR{ x }
71 \orGOO{\kwd{:start} \VAR{ start}\DF{\LIT{0}}\\
72 \kwd{:end} \VAR{ end}\DF{\NIL}}{\}})}{.}}
74 Convert \VAR{x} (\kwd{symbol}, \kwd{string}, or \kwd{character})
75 into a \retval{string}, a \retval{string with capitalized words},
76 an \retval{all-uppercase string}, or an \retval{all-lowercase
77 string}, respectively.
80 \IT{(\xorGOO{%
81 \FU*{NSTRING-CAPITALIZE}\\
82 \FU*{NSTRING-UPCASE}\\
83 \FU*{NSTRING-DOWNCASE}}{\}}
84 \VAR{\DES{string}}
85 \orGOO{\kwd{:start} \VAR{ start}\DF{\LIT{0}}\\
86 \kwd{:end} \VAR{ end}\DF{\NIL}}{\}})}
88 Convert \VAR{string} into a \retval{string with capitalized
89 words}, an \retval{all-uppercase string}, or an
90 \retval{all-lowercase string}, respectively.
93 \IT{(\xorGOO{\FU*{STRING-TRIM}\\
94 \FU*{STRING-LEFT-TRIM}\\
95 \FU*{STRING-RIGHT-TRIM}}{\}} \VAR{char-bag} \VAR{string})}
97 Return \retval{\VAR{string}} with all characters in sequence
98 \VAR{char-bag} removed from both ends, from the beginning, or from
99 the end, respectively.
102 \IT{\arrGOO{(\FU*{CHAR} \VAR{ string} \VAR{ i})\\
103 (\FU*{SCHAR} \VAR{ string} \VAR{ i})}{.}}
105 Return zero-indexed \retval{\VAR{i}th character} of string
106 ignoring/obeying, respectively, fill pointer. \kwd{setf}able.
109 \IT{(\FU*{PARSE-INTEGER} \VAR{string}
110 \orGOO{\kwd{:start} \VAR{ start}\DF{\LIT{0}}\\
111 \kwd{:end} \VAR{ end}\DF{\NIL}\\
112 \kwd{:radix} \VAR{ int}\DF{\LIT{10}}\\
113 \kwd{:junk-allowed} \VAR{ bool}\DF{\NIL}}{\}})}
115 Return \retval{integer} parsed from \VAR{string} and
116 \retvalii{index} of parse end.
119 \end{LIST}
121 %%% Local Variables:
122 %%% mode: latex
123 %%% TeX-master: "clqr"
124 %%% End: