当前位置: 首页>>代码示例>>PHP>>正文


PHP utf8::utf8_to_numeric方法代码示例

本文整理汇总了PHP中utf8::utf8_to_numeric方法的典型用法代码示例。如果您正苦于以下问题:PHP utf8::utf8_to_numeric方法的具体用法?PHP utf8::utf8_to_numeric怎么用?PHP utf8::utf8_to_numeric使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utf8的用法示例。


在下文中一共展示了utf8::utf8_to_numeric方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testUtf8_to_numeric

 public function testUtf8_to_numeric()
 {
     $s = 'é';
     $as = 0xe9;
     $rs = utf8::utf8_to_numeric($s);
     $this->assertEquals($as, $rs, '1 - ');
     $s = '5';
     $as = 0x35;
     $rs = utf8::utf8_to_numeric($s);
     $this->assertEquals($as, $rs, '2 - ');
 }
开发者ID:nrc-cnrc,项目名称:InuktitutToolkit,代码行数:11,代码来源:utf8Test.php

示例2: iciUnicodeToNoAipaitai

 public static function iciUnicodeToNoAipaitai($text)
 {
     $cnt = mb_strlen($text, 'UTF-8');
     $text_noaipaitai = "";
     for ($i = 0; $i < $cnt; $i++) {
         $c = mb_substr($text, $i, 1, 'UTF-8');
         $nc = utf8::utf8_to_numeric($c);
         if (array_key_exists($nc, self::$ais_in_unicode)) {
             $a = self::$ais_in_unicode[$nc]['UCnoaipaitai'];
             $utf8 = utf8::numeric_to_utf8($a);
             $text_noaipaitai .= $utf8;
         } else {
             $text_noaipaitai .= $c;
         }
     }
     return $text_noaipaitai;
 }
开发者ID:nrc-cnrc,项目名称:InuktitutToolkit,代码行数:17,代码来源:Syllabics.php

示例3: legacyToUnicode

 public static function legacyToUnicode($text, $aipaitai)
 {
     $cs = array();
     $dot = FALSE;
     $i = 0;
     $l = mb_strlen($text);
     $text_transcode = '';
     while ($i < $l) {
         $c = mb_substr($text, $i, 1);
         $nc = utf8::utf8_to_numeric($c);
         if ($nc == ord('w')) {
             $d = 0x1403;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('W')) {
             $d = 0x1431;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('t')) {
             $d = 0x144e;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('r')) {
             # ki
             $d = 0x146d;
             if ($dot) {
                 array_pop($cs);
             }
             if (count($cs) > 1 && $cs[count($cs) - 1] == 0x1550 && $cs[count($cs) - 2] == 0x1550) {
                 array_pop($cs);
                 array_pop($cs);
                 array_push($cs, 0x1585);
             } elseif (count($cs) > 1 && $cs[count($cs) - 1] == 0x1550 && $cs[count($cs) - 2] == 0x1585) {
                 array_pop($cs);
             } elseif (count($cs) > 0 && $cs[count($cs) - 1] == 0x1550) {
                 array_pop($cs);
                 $d = 0x157f;
             }
             if ($dot) {
                 $dot = FALSE;
                 $d++;
             }
         } elseif ($nc == ord('Q')) {
             # gi
             $d = 0x148b;
             if ($dot) {
                 array_pop($cs);
             }
             if (count($cs) != 0) {
                 $e = $cs[count($cs) - 1];
                 if ($e == 0x1595) {
                     # ng+gi
                     array_pop($cs);
                     $d = 0x158f;
                     # ngi
                 } elseif ($e == 0x1596) {
                     #nng+gi
                     array_pop($cs);
                     $d = 0x1671;
                     # nngi
                 }
             }
             if ($dot) {
                 $dot = FALSE;
                 $d++;
             }
         } elseif ($nc == ord('u')) {
             $d = 0x14a5;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('i')) {
             $d = 0x14c2;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('y')) {
             $d = 0x14ef;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('o')) {
             $d = 0x14d5;
             if ($dot) {
                 $dot = FALSE;
//.........这里部分代码省略.........
开发者ID:nrc-cnrc,项目名称:InuktitutToolkit,代码行数:101,代码来源:Nunacom.php

示例4: legacyToUnicode

 public static function legacyToUnicode($text, $aipaitai)
 {
     $cs = array();
     $dot = FALSE;
     $i = 0;
     $l = mb_strlen($text);
     while ($i < $l) {
         $c = mb_substr($text, $i, 1);
         $nc = utf8::utf8_to_numeric($c);
         if ($nc == ord('w')) {
             $d = 0x1403;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('W')) {
             $d = 0x1431;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('t')) {
             $d = 0x144e;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('r')) {
             # ki
             $d = 0x146d;
             if ($dot) {
                 array_pop($cs);
             }
             if (count($cs) > 1 && $cs[count($cs) - 1] == 0x1550 && $cs[count($cs) - 2] == 0x1550) {
                 array_pop($cs);
                 array_pop($cs);
                 array_push($cs, 0x1585);
             } elseif (count($cs) > 1 && $cs[count($cs) - 1] == 0x1550 && $cs[count($cs) - 2] == 0x1585) {
                 array_pop($cs);
             } elseif (count($cs) > 0 && $cs[count($cs) - 1] == 0x1550) {
                 array_pop($cs);
                 $d = 0x157f;
             }
             if ($dot) {
                 $dot = FALSE;
                 $d++;
             }
         } elseif ($nc == ord('Q')) {
             # gi
             $d = 0x148b;
             if ($dot) {
                 array_pop($cs);
             }
             if (count($cs) != 0) {
                 $e = $cs[count($cs) - 1];
                 if ($e == 0x1595) {
                     # ng+gi
                     array_pop($cs);
                     $d = 0x158f;
                     # ngi
                 } elseif ($e == 0x1596) {
                     #nng+gi
                     array_pop($cs);
                     $d = 0x1671;
                     # nngi
                 }
             }
             if ($dot) {
                 $dot = FALSE;
                 $d++;
             }
         } elseif ($nc == ord('u')) {
             $d = 0x14a5;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('i')) {
             $d = 0x14c2;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('y')) {
             $d = 0x14ef;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
                 $d++;
             }
         } elseif ($nc == ord('o')) {
             $d = 0x14d5;
             if ($dot) {
                 $dot = FALSE;
                 array_pop($cs);
//.........这里部分代码省略.........
开发者ID:nrc-cnrc,项目名称:InuktitutToolkit,代码行数:101,代码来源:Prosyl.php

示例5: unicodeToSlashUUnicodeString

 function unicodeToSlashUUnicodeString($text)
 {
     $cnt = mb_strlen($text);
     $i = 0;
     $res = '';
     while ($i < $cnt) {
         $c = mb_substr($text, $i++, 1);
         $nc = utf8::utf8_to_numeric($c);
         $res .= sprintf("\\u%04x", $nc);
     }
     return $res;
 }
开发者ID:nrc-cnrc,项目名称:InuktitutToolkit,代码行数:12,代码来源:Transcoder.php


注:本文中的utf8::utf8_to_numeric方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。