1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>string= (ANSI and GNU Common Lisp Document)</title>
<meta name="description" content="string= (ANSI and GNU Common Lisp Document)">
<meta name="keywords" content="string= (ANSI and GNU Common Lisp Document)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Strings-Dictionary.html" rel="up" title="Strings Dictionary">
<link href="stringp.html" rel="next" title="stringp">
<link href="string_002dtrim.html" rel="prev" title="string-trim">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<span id="string_003d"></span><div class="header">
<p>
Next: <a href="stringp.html" accesskey="n" rel="next">stringp</a>, Previous: <a href="string_002dtrim.html" accesskey="p" rel="prev">string-trim</a>, Up: <a href="Strings-Dictionary.html" accesskey="u" rel="up">Strings Dictionary</a> </p>
</div>
<hr>
<span id="string_003d_002c-string_002f_003d_002c-string_003c_002c-string_003e_002c-string_003c_003d_002c-string_003e_003d_002c"></span><h4 class="subsection">16.2.10 string=, string/=, string<, string>, string<=, string>=,</h4>
<span id="string_002dequal_002c-string_002dnot_002dequal_002c-string_002dlessp_002c"></span><h4 class="subheading">string-equal, string-not-equal, string-lessp,</h4>
<span id="string_002dgreaterp_002c-string_002dnot_002dgreaterp_002c-string_002dnot_002dlessp"></span><h4 class="subheading">string-greaterp, string-not-greaterp, string-not-lessp</h4>
<p align="right"><i>[Function]</i>
</p>
<p><code>string=</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>generalized-boolean</i>
</p>
<p><code>string/=</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>mismatch-index</i>
</p>
<p><code>string<</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>mismatch-index</i>
</p>
<p><code>string></code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>mismatch-index</i>
</p>
<p><code>string<=</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>mismatch-index</i>
</p>
<p><code>string>=</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>mismatch-index</i>
</p>
<p><code>string-equal</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>generalized-boolean</i>
</p>
<p><code>string-not-equal</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>mismatch-index</i>
</p>
<p><code>string-lessp</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>mismatch-index</i>
</p>
<p><code>string-greaterp</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>mismatch-index</i>
</p>
<p><code>string-not-greaterp</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>mismatch-index</i>
</p>
<p><code>string-not-lessp</code> <i>string1 string2 <span class="roman">&key</span> start1 end1 start2 end2</i> ⇒ <i>mismatch-index</i>
</p>
<span id="Arguments-and-Values_003a_003a-351"></span><h4 class="subsubheading">Arguments and Values::</h4>
<p><i>string1</i>—a <i>string designator</i>.
</p>
<p><i>string2</i>—a <i>string designator</i>.
</p>
<p><i>start1</i>, <i>end1</i>—<i>bounding index designators</i> of <i>string1</i>.
The defaults for <i>start</i> and <i>end</i> are <tt>0</tt> and <b>nil</b>, respectively.
</p>
<p><i>start2</i>, <i>end2</i>—<i>bounding index designators</i> of <i>string2</i>.
The defaults for <i>start</i> and <i>end</i> are <tt>0</tt> and <b>nil</b>, respectively.
</p>
<p><i>generalized-boolean</i>—a <i>generalized boolean</i>.
</p>
<p><i>mismatch-index</i>—a <i>bounding index</i> of <i>string1</i>, or <b>nil</b>.
</p>
<span id="Description_003a_003a-465"></span><h4 class="subsubheading">Description::</h4>
<p>These functions perform lexicographic comparisons on <i>string1</i> and <i>string2</i>.
<b>string=</b> and <b>string-equal</b> are called equality functions;
the others are called inequality functions.
The comparison operations these <i>functions</i> perform are restricted
to the subsequence of <i>string1</i> <i>bounded</i> by <i>start1</i> and <i>end1</i>
and to the subsequence of <i>string2</i> <i>bounded</i> by <i>start2</i> and <i>end2</i>.
</p>
<p>A string <i>a</i> is equal to a string <i>b</i> if it contains the same number
of characters, and the corresponding characters are the <i>same</i>
under <b>char=</b> or <b>char-equal</b>, as appropriate.
</p>
<p>A string <i>a</i> is less than a string <i>b</i> if in the first position in
which they differ the character of <i>a</i> is less than the corresponding
character of <i>b</i> according to <b>char<</b> or <b>char-lessp</b>
as appropriate, or if string <i>a</i> is a proper prefix of string <i>b</i>
(of shorter length and matching in all the characters of <i>a</i>).
</p>
<p>The equality functions return a <i>generalized boolean</i>
that is <i>true</i> if the strings are equal,
or <i>false</i> otherwise.
</p>
<p>The inequality functions return a <i>mismatch-index</i>
that is <i>true</i> if the strings are not equal,
or <i>false</i> otherwise.
When the <i>mismatch-index</i> is <i>true</i>,
it is an <i>integer</i> representing the first character position at which the
two substrings differ, as an offset from the beginning of <i>string1</i>.
</p>
<p>The comparison has one of the following results:
</p>
<dl compact="compact">
<dt><b>string=</b></dt>
<dd><p><b>string=</b> is <i>true</i> if the supplied substrings are of
the same length and contain the <i>same</i> characters in corresponding
positions; otherwise it is <i>false</i>.
</p>
</dd>
<dt><b>string/=</b></dt>
<dd><p><b>string/=</b> is <i>true</i> if the supplied substrings are
different; otherwise it is <i>false</i>.
</p>
</dd>
<dt><b>string-equal</b></dt>
<dd><p><b>string-equal</b> is just like <b>string=</b>
except that differences in case are ignored;
two characters are considered to be the same if <b>char-equal</b> is <i>true</i> of them.
</p>
</dd>
<dt><b>string<</b></dt>
<dd><p><b>string<</b> is <i>true</i> if substring1 is less than substring2;
otherwise it is <i>false</i>.
</p>
</dd>
<dt><b>string></b></dt>
<dd><p><b>string></b> is <i>true</i> if substring1 is greater than substring2;
otherwise it is <i>false</i>.
</p>
</dd>
<dt><b>string-lessp</b>, <b>string-greaterp</b></dt>
<dd><p><b>string-lessp</b> and <b>string-greaterp</b>
are exactly like <b>string<</b> and <b>string></b>, respectively,
except that distinctions between uppercase and lowercase letters are ignored.
It is as if <b>char-lessp</b> were used instead of <b>char<</b>
for comparing characters.
</p>
</dd>
<dt><b>string<=</b></dt>
<dd><p><b>string<=</b> is <i>true</i> if substring1 is less than or equal to substring2;
otherwise it is <i>false</i>.
</p>
</dd>
<dt><b>string>=</b></dt>
<dd><p><b>string>=</b> is <i>true</i> if substring1 is greater than or equal to substring2;
otherwise it is <i>false</i>.
</p>
</dd>
<dt><b>string-not-greaterp</b>, <b>string-not-lessp</b></dt>
<dd><p><b>string-not-greaterp</b> and <b>string-not-lessp</b>
are exactly like <b>string<=</b> and <b>string>=</b>, respectively,
except that distinctions between uppercase and lowercase letters are ignored.
It is as if <b>char-lessp</b> were used instead of <b>char<</b>
for comparing characters.
</p>
</dd>
</dl>
<span id="Examples_003a_003a-333"></span><h4 class="subsubheading">Examples::</h4>
<div class="example">
<pre class="example"> (string= "foo" "foo") ⇒ <i>true</i>
(string= "foo" "Foo") ⇒ <i>false</i>
(string= "foo" "bar") ⇒ <i>false</i>
(string= "together" "frog" :start1 1 :end1 3 :start2 2) ⇒ <i>true</i>
(string-equal "foo" "Foo") ⇒ <i>true</i>
(string= "abcd" "01234abcd9012" :start2 5 :end2 9) ⇒ <i>true</i>
(string< "aaaa" "aaab") ⇒ 3
(string>= "aaaaa" "aaaa") ⇒ 4
(string-not-greaterp "Abcde" "abcdE") ⇒ 5
(string-lessp "012AAAA789" "01aaab6" :start1 3 :end1 7
:start2 2 :end2 6) ⇒ 6
(string-not-equal "AAAA" "aaaA") ⇒ <i>false</i>
</pre></div>
<span id="See-Also_003a_003a-379"></span><h4 class="subsubheading">See Also::</h4>
<p><a href="char_003d.html">char=</a>
</p>
<span id="Notes_003a_003a-254"></span><h4 class="subsubheading">Notes::</h4>
<p><b>equal</b> calls <b>string=</b> if applied to two <i>strings</i>.
</p>
<hr>
<div class="header">
<p>
Next: <a href="stringp.html" accesskey="n" rel="next">stringp</a>, Previous: <a href="string_002dtrim.html" accesskey="p" rel="prev">string-trim</a>, Up: <a href="Strings-Dictionary.html" accesskey="u" rel="up">Strings Dictionary</a> </p>
</div>
</body>
</html>
|