Angelscript/docs/manual/doc_datatypes_strings.html

161 lines
9.0 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AngelScript: Strings</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="aslogo_small.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">AngelScript
</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('doc_datatypes_strings.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">Strings </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><dl class="section note"><dt>Note</dt><dd>Strings are only available in the scripts if the application <a class="el" href="doc_addon_std_string.html">registers the support for them</a>. The syntax for using strings may differ for the application you're working with so consult the application's manual for more details.</dd></dl>
<p>Strings hold an array of bytes or 16bit words depending on the application settings. Normally they are used to store text but can really store any kind of binary data.</p>
<p>There are two types of string constants supported in the AngelScript language, the normal quoted string, and the documentation strings, called heredoc strings.</p>
<p>The normal strings are written between double quotation marks (<code>"</code>) or single quotation marks (<code>'</code>). Inside the constant strings some escape sequences can be used to write exact byte values that might not be possible to write in your normal editor.</p>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="100" valign="top"><b>sequence</b> </td><td valign="top" width="100"><b>value</b> </td><td valign="top"><p class="starttd"><b>description</b></p>
<p class="endtd"></p>
</td></tr>
<tr>
<td width="80" valign="top"><code>\0</code>&#160; </td><td valign="top" width="50">0 </td><td valign="top">null character </td></tr>
<tr>
<td width="80" valign="top"><code>\\</code>&#160; </td><td valign="top" width="50">92 </td><td valign="top">back-slash </td></tr>
<tr>
<td width="80" valign="top"><code>\'</code>&#160; </td><td valign="top" width="50">39 </td><td valign="top">single quotation mark (apostrophe) </td></tr>
<tr>
<td width="80" valign="top"><code>\"</code>&#160; </td><td valign="top" width="50">34 </td><td valign="top">double quotation mark </td></tr>
<tr>
<td width="80" valign="top"><code>\n</code>&#160; </td><td valign="top" width="50">10 </td><td valign="top">new line feed </td></tr>
<tr>
<td width="80" valign="top"><code>\r</code>&#160; </td><td valign="top" width="50">13 </td><td valign="top">carriage return </td></tr>
<tr>
<td width="80" valign="top"><code>\t</code>&#160; </td><td valign="top" width="50">9 </td><td valign="top">tab character </td></tr>
<tr>
<td width="80" valign="top"><code>\xFFFF</code>&#160; </td><td valign="top" width="50">0xFFFF </td><td valign="top">FFFF should be exchanged for a 1 to 4 digit hexadecimal number representing the value wanted. If the application uses 8bit strings then only values up to 255 is accepted. </td></tr>
<tr>
<td width="80" valign="top"><code>\uFFFF</code>&#160; </td><td valign="top" width="50">0xFFFF </td><td valign="top">FFFF should be exchanged for the hexadecimal number representing the unicode code point </td></tr>
<tr>
<td width="80" valign="top"><code>\UFFFFFFFF</code>&#160; </td><td valign="top" width="50">0xFFFFFFFF </td><td valign="top">FFFFFFFF should be exchanged for the hexadecimal number representing the unicode code point </td></tr>
</table>
<pre>
string str1 = "This is a string with \"escape sequences" .";
string str2 = 'If single quotes are used then double quotes can be included without "escape sequences".';
</pre><p>The heredoc strings are designed for inclusion of large portions of text without processing of escape sequences. A heredoc string is surrounded by triple double-quotation marks (<code>"""</code>), and can span multiple lines of code. If the characters following the start of the string until the first linebreak only contains white space, it is automatically removed by the compiler. Likewise if the characters following the last line break until the end of the string only contains white space this is also removed.</p>
<pre>
string str = """
This is some text without "escape sequences". This is some text.
This is some text. This is some text. This is some text. This is
some text. This is some text. This is some text. This is some
text. This is some text. This is some text. This is some text.
This is some text.
""";
</pre><p>If more than one string constants are written in sequence with only whitespace or comments between them the compiler will concatenate them into one constant.</p>
<pre>
string str = "First line.\n"
"Second line.\n"
"Third line.\n";
</pre><p>The escape sequences \u and \U will add the specified unicode code point as a UTF-8 or UTF-16 encoded sequence depending on the application settings. Only valid unicode 5.1 code points are accepted, i.e. code points between U+D800 and U+DFFF (reserved for surrogate pairs) or above U+10FFFF are not accepted.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="doc_script_stdlib_string.html">string</a> </dd></dl>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Sat Dec 5 2020 23:20:24 for AngelScript by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.18 </li>
</ul>
</div>
</body>
</html>