php-doc-en/reference/intl/normalizer/get-raw-decomposition.xml
Peter Cowburn 7fab73b059 Initial docs for Normalizer::getRawDecomposition()
Patch provided by Ekin (me@ekins.space)


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@344570 c90b9560-bf6c-de11-be94-00142212c4b1
2018-03-26 21:14:43 +00:00

154 lines
4.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="normalizer.getrawdecomposition" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Normalizer::getRawDecomposition</refname>
<refname>normalizer_get_raw_decomposition</refname>
<refpurpose>Gets the Decomposition_Mapping property for the given UTF-8 encoded code point</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>&style.oop;</para>
<methodsynopsis role="oop">
<modifier>public</modifier>
<modifier>static</modifier>
<type>string</type>
<methodname>Normalizer::getRawDecomposition</methodname>
<methodparam><type>string</type><parameter>input</parameter></methodparam>
</methodsynopsis>
<para>&style.procedural;</para>
<methodsynopsis role="procedural">
<type>string</type><methodname>normalizer_get_raw_decomposition</methodname>
<methodparam><type>string</type><parameter>input</parameter></methodparam>
</methodsynopsis>
<para>
Gets the Decomposition_Mapping property, as specified in the
Unicode Character Database (UCD), for the given UTF-8 encoded code point.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>input</parameter></term>
<listitem>
<para>
The input string, which should be a single, UTF-8 encoded, code point.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a <type>string</type> containing the Decomposition_Mapping property, if present in the UCD.
</para>
<para>
Returns &null; if there is no Decomposition_Mapping property for the character.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="normalizer.getrawdecomposition.example.basic">
<title><methodname>Normalizer::getRawDecomposition</methodname> example</title>
<programlisting role="php">
<![CDATA[
<?php
$result = "";
$strings = [
"a",
"\u{FFDA}",
"\u{FDFA}",
"",
"aa",
"\xF5",
];
foreach ($strings as $string) {
$decomposition = Normalizer::getRawDecomposition($string);
// $decomposition = normalizer_get_raw_decomposition($string); Procedural way
$error_code = intl_get_error_code();
$error_message = intl_get_error_message();
$string_hex = bin2hex($string);
$result .= "---------------------\n";
if ($decomposition === null) {
$result .= "'$string_hex' has no decomposition mapping\n" ;
} else {
$result .= "'$string_hex' has the decomposition mapping '" . bin2hex($decomposition) . "'\n" ;
}
$result .= "error info: '$error_message' ($error_code)\n";
}
echo $result;
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
---------------------
'61' has no decomposition mapping
error info: 'U_ZERO_ERROR' (0)
---------------------
'efbf9a' has the decomposition mapping 'e385a1'
error info: 'U_ZERO_ERROR' (0)
---------------------
'efb7ba' has the decomposition mapping 'd8b5d984d98920d8a7d984d984d98720d8b9d984d98ad98720d988d8b3d984d985'
error info: 'U_ZERO_ERROR' (0)
---------------------
'' has no decomposition mapping
error info: 'Input string must be exactly one UTF-8 encoded code point long.: U_ILLEGAL_ARGUMENT_ERROR' (1)
---------------------
'6161' has no decomposition mapping
error info: 'Input string must be exactly one UTF-8 encoded code point long.: U_ILLEGAL_ARGUMENT_ERROR' (1)
---------------------
'f5' has no decomposition mapping
error info: 'Code point out of range: U_ILLEGAL_ARGUMENT_ERROR' (1)
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Normalizer::normalize</methodname></member>
<member><methodname>Normalizer::isNormalized</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!--
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->