Document comparison ignoring diacritics and case sensitivity

This commit is contained in:
Derick Rethans 2021-08-06 17:32:19 +01:00
parent 2b2edac59b
commit 7f6b41f74c

View file

@ -127,6 +127,33 @@ if ($res === false) {
</screen>
</example>
</para>
<para>
<example>
<title>Comparing strings without diacritics or case-sensitivy</title>
<programlisting role="php">
<![CDATA[
<?php
$c = new Collator( 'en' );
$c->setStrength( Collator::PRIMARY );
if ( $c->compare( 'Séan', 'Sean' ) == 0 )
{
echo "The same\n";
}
]]>
</programlisting>
&example.outputs;
<screen>
The same
</screen>
<para>
This example instructs the collator to compare with only taking the base
characters into account. The documentation for
<function>Collator->setStrength</function> explains the different
strengths.
</para>
</example>
</para>
</refsect1>
<refsect1 role="seealso">