<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css">
<title>
Gambas Documentation - Chr$
</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../help+en"><img class="flag" alt="Home" border="0" src="../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../lang+en">Up</a>&nbsp;
<a href="choose+en">Previous</a>&nbsp;
<a href="cint+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
Chr$
</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><u>Character</u> <b>= Chr$ (</b> <u>Code</u> AS Integer <b>)</b> AS String
<u>Character</u> <b>= Chr (</b> <u>Code</u> AS Integer <b>)</b> AS String</pre><p>

Returns the character whose <a href="../def/ascii+en">ASCII</a> code is <u>Code</u>.
<p>
<div class="warning"><table class="none" border="0"><tr><td width="40" valign="top"><img border="0" src="../../img/warning.png" align="center"></td><td valign="top">
Be careful! <a href="../def/gambas+en">Gambas</a> uses the <a href="../def/utf8+en">UTF-8</a> charset internally, so character code greater than 128 have not
the meaning they have with a charset like <a href="../def/iso8859+en">ISO 8859</a>-1. This is a problem especially if you have to process special characters of some languages like the German umlauts. You might want to convert the string into <a href="../def/ascii+en">ASCII</a> using the <a href="conv+en">Conv$</a>() function before processing it.
</td></tr></table></div>
<p>
<div class="gray"><font size="-2"><b>Errors</b></font></div>
<table class="table" border="0" bordercolor="#000000" cellpadding="6" cellspacing="0" width="100%">
<tr><th>Message</th><th>Description</th></tr><tr class="dark"><td valign="top">
<a href="../error/arg+en">Bad argument (#20)</a>
</td><td valign="top">
<u>Code</u> is negative or greater than <tt>255</tt>.
</td></tr>
</table>
<p>
<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">PRINT Chr$(65)
<hr>A</pre>
<p>
<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">PUBLIC SUB Button1_Click()

  DIM X AS Integer

  FOR X = 32 TO 127
    PRINT Chr$(X);
  NEXT

END</pre>
<p>
<hr><b>See also</b><br>
<a href="../cat/string+en">String Functions</a>&nbsp;

</div>
</body>
</html>

