aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2015-01-09 22:32:08 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2015-01-09 22:32:08 +0100
commit4ac9e7a5db862309f5078e42b60d963f93000f89 (patch)
tree09b3c88468082483a5235bc5ecfcf027a78ee6ca
parent9cfd2f192e22d5e79e047c2be02a5b41daff61d2 (diff)
downloadUstring-4ac9e7a5db862309f5078e42b60d963f93000f89.zip
Ustring-4ac9e7a5db862309f5078e42b60d963f93000f89.tar.gz
Ustring-4ac9e7a5db862309f5078e42b60d963f93000f89.tar.bz2
Translate #Code-point.
-rw-r--r--Documentation/En/Index.xyl22
1 files changed, 22 insertions, 0 deletions
diff --git a/Documentation/En/Index.xyl b/Documentation/En/Index.xyl
index 3957685..2c2c20f 100644
--- a/Documentation/En/Index.xyl
+++ b/Documentation/En/Index.xyl
@@ -502,5 +502,27 @@ $string->match(
with 3 bytes. We can also get a specific byte thanks to the
<code>Hoa\String\String::getByteAt</code> method. Once again, the index is not
bounded.</p>
+
+ <h3 id="Code-point" for="main-toc">Code-point</h3>
+
+ <p>Each character is represented by an integer, called a
+ <strong>code-point</strong>. To get the code-point of a character, we can
+ use the <code>Hoa\String\String::toCode</code> static method, and to get a
+ character based on its code-point, we can use the
+ <code>Hoa\String\String::fromCode</code> static method. We also have the
+ <code>Hoa\String\String::toBinaryCode</code> method which returns the binary
+ representation of a character. Let's take an example:</p>
+ <pre><code class="language-php">var_dump(
+ Hoa\String\String::toCode('Σ'),
+ Hoa\String\String::toBinaryCode('Σ'),
+ Hoa\String\String::fromCode(0x1a9)
+);
+
+/**
+ * Will output:
+ * int(931)
+ * string(32) "1100111010100011"
+ * string(2) "Σ"
+ */</code></pre>
</yield>
</overlay>