<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>2.4. Characters</title><link rel="stylesheet" href="ecl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="The ECL manual"><link rel="up" href="ch25.html" title="Chapter 2. Manipulating Lisp objects"><link rel="prev" href="ch25s03.html" title="2.3. Integers"><link rel="next" href="ch25s05.html" title="2.5. Arrays"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.4. Characters</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch25s03.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Manipulating Lisp objects</th><td width="20%" align="right"> <a accesskey="n" href="ch25s05.html">Next</a></td></tr></table><hr></div><div class="section" title="2.4. Characters"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="Internals-Characters"></a>2.4. Characters</h2></div></div></div><p><span class="application">ECL</span> has only one type of characters, which fits in the C type <code class="literal">char</code>. The following constants and functions operate on characters.</p><div class="blockquote"><blockquote class="blockquote"><pre class="screen"><a class="indexterm" name="id677435"></a>— Constant: <code class="varname">CHAR_CODE_LIMIT</code></pre><p>Each character is assigned an integer code which ranges from 0 to (<em class="replaceable"><code>CHAR_CODE_LIMIT</code></em>-1).</p></blockquote></div><div class="blockquote"><blockquote class="blockquote"><pre class="screen"><a class="indexterm" name="id677462"></a>— Function: <span class="returnvalue">cl_fixnum</span> <code class="function">CHAR_CODE</code> (<span class="type">cl_object</span> <code class="varname">o</code>)</pre><pre class="screen"><a class="indexterm" name="id677491"></a>— Function: <span class="returnvalue">cl_fixnum</span> <code class="function">char_code</code> (<span class="type">cl_object</span> <code class="varname">o</code>)</pre><p>Returns the integer code associated to a lisp character. Only <code class="literal">char_code</code> checks its arguments.</p></blockquote></div><div class="blockquote"><blockquote class="blockquote"><pre class="screen"><a class="indexterm" name="id677533"></a>— Function: <span class="returnvalue">cl_object</span> <code class="function">CODE_CHAR</code> (<span class="type">cl_fixnum</span> <code class="varname">o</code>)</pre><p>Returns the lisp character associated to an integer code. It does not check its arguments.</p></blockquote></div><div class="blockquote"><blockquote class="blockquote"><pre class="screen"><a class="indexterm" name="id677570"></a>— Function: <span class="returnvalue">cl_object</span> <code class="function">coerce_to_character</code> (<span class="type">cl_object</span> <code class="varname">o</code>)</pre><p>Coerces a lisp object to type character. Valid arguments are a character, or a string designator of length 1. In all other cases an error is signaled.</p></blockquote></div><div class="blockquote"><blockquote class="blockquote"><pre class="screen"><a class="indexterm" name="id677607"></a>— Function: <span class="returnvalue">bool</span> <code class="function">char_eq</code> (<span class="type">cl_object</span> <code class="varname">x</code>, <span class="type">cl_object</span> <code class="varname">y</code>)</pre><pre class="screen"><a class="indexterm" name="id677644"></a>— Function: <span class="returnvalue">bool</span> <code class="function">char_equal</code> (<span class="type">cl_object</span> <code class="varname">x</code>, <span class="type">cl_object</span> <code class="varname">y</code>)</pre><p>Compare two characters for equality. <code class="literal">char_eq</code> take case into account and <code class="literal">char_equal</code> ignores it.</p></blockquote></div><div class="blockquote"><blockquote class="blockquote"><pre class="screen"><a class="indexterm" name="id677699"></a>— Function: <span class="returnvalue">int</span> <code class="function">char_cmp</code> (<span class="type">cl_object</span> <code class="varname">x</code>, <span class="type">cl_object</span> <code class="varname">y</code>)</pre><pre class="screen"><a class="indexterm" name="id677734"></a>— Function: <span class="returnvalue">int</span> <code class="function">char_compare</code> (<span class="type">cl_object</span> <code class="varname">x</code>, <span class="type">cl_object</span> <code class="varname">y</code>)</pre><p>Compare the relative order of two characters. <code class="literal">char_cmp</code> takes care of case and <code class="literal">char_compare</code> converts all characters to uppercase before comparing them.</p></blockquote></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch25s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch25.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch25s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.3. Integers </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.5. Arrays</td></tr></table></div></body></html>