Normalizer::getRawDecomposition

normalizer_get_raw_decomposition

(PHP 7 >= 7.3, PHP 8)

Normalizer::getRawDecomposition -- normalizer_get_raw_decomposition — Renvoie la propriété Decomposition_Mapping pour le point de code UTF-8 donné

Description

Style orienté objet

public static function Normalizer::getRawDecomposition(string $string, int $form = Normalizer::FORM_C ): ? string

Style procédural

function normalizer_get_raw_decomposition(string $string, int $form = Normalizer::FORM_C ): ? string

Renvoie la propriété Decomposition_Mapping, telle que spécifiée dans la base de données de caractères Unicode (UCD), pour le point de code UTF-8 donné.

Liste de paramètres

string

La chaîne d'entrée, qui doit être un seul point de code UTF-8.

Valeurs de retour

Renvoie un string contenant la propriété Decomposition_Mapping, si elle est présente dans l'UCD.

Renvoie null s'il n'y a pas de propriété Decomposition_Mapping pour le caractère.

Exemples

Exemple #1 Exemple de Normalizer::getRawDecomposition()

<?php
$result = "";
$strings = [
 "a",
 "\u{FFDA}",
 "\u{FDFA}",
 "",
 "aa",
 "\xF5",
];
foreach ($strings as $string) {
 $decomposition = Normalizer::getRawDecomposition($string);
 // $decomposition = normalizer_get_raw_decomposition($string); Approche procédurale
 $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;
?>

L'exemple ci-dessus va afficher :

---------------------
'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)

Voir aussi

Found A Problem?

Learn How To Improve This Page • Submit a Pull Request • Report a Bug
+add a note

User Contributed Notes

There are no user contributed notes for this page.

AltStyle によって変換されたページ (->オリジナル) /