mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-27 14:28:56 +00:00
149 lines
4.6 KiB
XML
149 lines
4.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="transliterator.transliterate" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>Transliterator::transliterate</refname>
|
|
<refname>transliterator_transliterate</refname>
|
|
<refpurpose>Transliterate a string</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<para>&style.oop;</para>
|
|
<methodsynopsis role="oop">
|
|
<modifier>public</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>Transliterator::transliterate</methodname>
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>start</parameter><initializer>0</initializer></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>end</parameter><initializer>-1</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>&style.procedural;</para>
|
|
<methodsynopsis role="procedural">
|
|
<type class="union"><type>string</type><type>false</type></type><methodname>transliterator_transliterate</methodname>
|
|
<methodparam><type class="union"><type>Transliterator</type><type>string</type></type><parameter>transliterator</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>start</parameter><initializer>0</initializer></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>end</parameter><initializer>-1</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Transforms a string or part thereof using an ICU transliterator.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>transliterator</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
In the procedural version, either a <classname>Transliterator</classname>
|
|
or a <type>string</type> from which a
|
|
<classname>Transliterator</classname> can be built.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>string</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The string to be transformed.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>start</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The start index (in UTF-16 code units) from which the string will start
|
|
to be transformed, inclusive. Indexing starts at 0. The text before will
|
|
be left as is.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>end</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The end index (in UTF-16 code units) until which the string will be
|
|
transformed, exclusive. Indexing starts at 0. The text after will be
|
|
left as is.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
The transformed string on success, &return.falseforfailure;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Converting escaped UTF-16 code units</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$s = "\u304A\u65E9\u3046\u3054\u3056\u3044\u307E\u3059";
|
|
echo transliterator_transliterate("Hex-Any/Java", $s), "\n";
|
|
|
|
//now the reverse operation with a supplementary character
|
|
$supplChar = html_entity_decode('𝄞');
|
|
echo mb_strlen($supplChar, "UTF-8"), "\n";
|
|
$encSupplChar = transliterator_transliterate("Any-Hex/Java", $supplChar);
|
|
//echoes two encoded UTF-16 code units
|
|
echo $encSupplChar, "\n";
|
|
//and back
|
|
echo transliterator_transliterate("Hex-Any/Java", $encSupplChar), "\n";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
お早うございます
|
|
1
|
|
\uD834\uDD1E
|
|
𝄞
|
|
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><methodname>Transliterator::getErrorMessage</methodname></member>
|
|
<member><methodname>Transliterator::__construct</methodname></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
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
|
|
-->
|