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


PHP Normalizer类代码示例

本文整理汇总了PHP中Normalizer的典型用法代码示例。如果您正苦于以下问题:PHP Normalizer类的具体用法?PHP Normalizer怎么用?PHP Normalizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 /**
  * Class constructor.
  *
  * @param mixed $string
  * @param string $encoding
  * @throws \InvalidArgumentException
  */
 public function __construct($string, $encoding = self::ENCODING)
 {
     if (is_null($string)) {
         $string = 'null';
     } elseif (is_bool($string)) {
         $string = $string ? 'true' : 'false';
     } elseif (is_int($string) || is_float($string)) {
         $string = (string) $string;
     } elseif (is_object($string)) {
         if (!method_exists($string, '__toString')) {
             throw new \InvalidArgumentException(sprintf('Object of class %s cannot be converted to String', get_class($string)));
         }
         $string = (string) $string;
     } elseif (!is_string($string)) {
         throw new \InvalidArgumentException('Cannot convert a variable of type ' . gettype($string) . ' to String');
     }
     if (!self::checkEncoding($encoding)) {
         throw new \InvalidArgumentException('Unsupported encoding: ' . $encoding);
     }
     if (!mb_check_encoding($string, $encoding)) {
         throw new \InvalidArgumentException('String is not encoded in ' . $encoding);
     }
     if ($encoding != self::ENCODING) {
         $string = mb_convert_encoding($string, self::ENCODING, $encoding);
     }
     $string = \Normalizer::normalize($string);
     $this->string = $string;
     $this->length = mb_strlen($string, self::ENCODING);
 }
开发者ID:e-ruiz,项目名称:brick,代码行数:36,代码来源:String.php

示例2: message

 public static function message($publishHandler, eZContentObject $object, $message, $messageLength = null, $options)
 {
     $url = false;
     if (isset($options['include_url']) && (bool) $options['include_url'] === true) {
         $url = $object->attribute('main_node')->attribute('url_alias');
         eZURI::transformURI($url, true, 'full');
         if (isset($options['shorten_url']) && (bool) $options['shorten_url'] === true) {
             $urlReturned = $publishHandler->shorten($url, $options['shorten_handler']);
             if (is_string($urlReturned)) {
                 $url = $urlReturned;
             }
         }
         if ($messageLength != null) {
             $messageLength = $messageLength - strlen($url) - 1;
         }
     }
     if (class_exists('Normalizer')) {
         $message = Normalizer::normalize($message, Normalizer::FORM_C);
     }
     if ($messageLength != null) {
         $message = mb_substr($message, 0, $messageLength);
     }
     if ($url) {
         $message .= ' ' . $url;
     }
     return $message;
 }
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:27,代码来源:nxcSocialNetworksMessageHandlerDefault.php

示例3: applyValue

 protected function applyValue($input, Context $ctx)
 {
     $output = $input;
     if ($input === null || $input === true || $input === false) {
         goto done;
     }
     if ($this->allowLoose) {
         $checkValue = $input;
         if (is_string($checkValue)) {
             $checkValue = mb_strtolower(\Normalizer::normalize($checkValue));
         }
         if (in_array($checkValue, $this->trueValues ?: self::$defaultLooseTrue, true)) {
             $output = true;
         } elseif (in_array($checkValue, $this->falseValues ?: self::$defaultLooseFalse, true)) {
             $output = false;
         }
     }
     if ($output !== false && $output !== true) {
         $ctx->addReason($this, ['id' => 'bool.invalid']);
     }
     done:
     if ($output !== $input) {
         $ctx->setChange(Change::Internal);
     }
     return $output;
 }
开发者ID:shabbyrobe,项目名称:fulfil,代码行数:26,代码来源:Bool_.php

示例4: simplify_strings

function simplify_strings($string)
{
    //Normalisation de la chaine utf8 en mode caractère + accents
    $string = Normalizer::normalize($string, Normalizer::FORM_D);
    //Suppression des accents et minuscules
    return strtolower(preg_replace('~\\p{Mn}~u', '', $string));
}
开发者ID:RadioCampusFrance,项目名称:podcast-rccf,代码行数:7,代码来源:search.php

示例5: convertToValidCharacters

 /**
  * 入力を妥当な値に変換します。
  * @param string $input
  * @return string 変換できなかった場合は空文字列を返します。
  */
 protected function convertToValidCharacters(string $input) : string
 {
     $converted = preg_replace('/[\\p{C}\\p{Z}\\p{M}]+/u', '', \Normalizer::normalize(str_replace('~', '〜', $input), \Normalizer::FORM_KC));
     if ($this->isRegExp($converted)) {
         $converted = trim($converted, '/');
     }
     return $converted;
 }
开发者ID:esperecyan,项目名称:dictionary-php,代码行数:13,代码来源:AnswerValidator.php

示例6: asciify

function asciify($text)
{
    global $special_cases, $special_cases_keys;
    $text = Normalizer::normalize($text, Normalizer::FORM_C);
    $text = str_replace($special_cases_keys, $special_cases, $text);
    $text = Normalizer::normalize($text, Normalizer::FORM_D);
    return preg_replace('/[^\\x20-\\x7E]/', '', $text);
}
开发者ID:ox-it,项目名称:asciification,代码行数:8,代码来源:php.php

示例7: testNormalizer

 public function testNormalizer()
 {
     $english = Normalizer::factory();
     $greek = Normalizer::factory("Greek");
     $this->assertEquals(explode(" ", "ο μορφωμενοσ διαφερει απο τον αμορφωτο οσο ο ζωντανοσ απο τον νεκρο"), $greek->normalizeAll(explode(" ", "Ο μορφωμένος διαφέρει από τον αμόρφωτο όσο ο ζωντανός από τον νεκρό")));
     $this->assertEquals(explode(" ", "ο μορφωμένος διαφέρει από τον αμόρφωτο όσο ο ζωντανός από τον νεκρό"), $english->normalizeAll(explode(" ", "Ο μορφωμένος διαφέρει από τον αμόρφωτο όσο ο ζωντανός από τον νεκρό")));
     $this->assertEquals(explode(" ", "when a father gives to his son both laugh when a son gives to his father both cry"), $english->normalizeAll(explode(" ", "When a father gives to his son both laugh when a son gives to his father both cry")));
 }
开发者ID:LewisGet,项目名称:php-nlp-tools,代码行数:8,代码来源:NormalizerTest.php

示例8: testStringUnicodeDifferentNormalisationEqual

 function testStringUnicodeDifferentNormalisationEqual()
 {
     $a = \Normalizer::normalize("ő", \Normalizer::FORM_KC);
     $b = \Normalizer::normalize("ő", \Normalizer::FORM_D);
     $this->assertNotEquals($a, $b);
     $flat = $this->compare($a, $b);
     $this->assertTrue($flat->valid);
 }
开发者ID:shabbyrobe,项目名称:fulfil,代码行数:8,代码来源:EqualTest.php

示例9: __construct

 /**
  * Class constructor.
  *
  * @param mixed $string
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(string $string)
 {
     if (!mb_check_encoding($string, 'UTF-8')) {
         throw new \InvalidArgumentException('String is not valid UTF-8');
     }
     $string = \Normalizer::normalize($string);
     $this->string = $string;
     $this->length = mb_strlen($string, 'UTF-8');
 }
开发者ID:brick,项目名称:brick,代码行数:16,代码来源:UnicodeString.php

示例10: of

 /**
  * Public factory method.
  *
  * @param string $string
  *
  * @return UnicodeString
  *
  * @throws \InvalidArgumentException
  */
 public static function of(string $string)
 {
     if (!mb_check_encoding($string, 'UTF-8')) {
         throw new \InvalidArgumentException('String is not valid UTF-8');
     }
     $string = \Normalizer::normalize($string);
     $length = mb_strlen($string, 'UTF-8');
     return new UnicodeString($string, $length);
 }
开发者ID:brick,项目名称:type,代码行数:18,代码来源:UnicodeString.php

示例11: unaccent

 /**
  * @see https://github.com/alixaxel/phunction/blob/master/phunction/Text.php#L297
  */
 public static function unaccent($string)
 {
     if (extension_loaded('intl') === true) {
         $string = \Normalizer::normalize($string, \Normalizer::FORM_KD);
     }
     if (strpos($string = htmlentities($string, ENT_QUOTES, 'UTF-8'), '&') !== false) {
         $string = html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|caron|cedil|circ|grave|lig|orn|ring|slash|tilde|uml);~i', '$1', $string), ENT_QUOTES, 'UTF-8');
     }
     return $string;
 }
开发者ID:bobbiebenton,项目名称:herbie,代码行数:13,代码来源:StringHelper.php

示例12: checkAndNormaliseEncoding

 private function checkAndNormaliseEncoding(string $text) : string
 {
     if (!mb_check_encoding($text, self::ENCODING)) {
         throw new MessagePostFailureException('Message text encoding invalid');
     }
     $text = \Normalizer::normalize(rtrim($text), \Normalizer::FORM_C);
     if ($text === false) {
         throw new MessagePostFailureException('Failed to normalize message text');
     }
     return $text;
 }
开发者ID:Room-11,项目名称:Jeeves,代码行数:11,代码来源:ChatClient.php

示例13: utf8_new_case_fold_nfkc

function utf8_new_case_fold_nfkc($text, $option = 'full')
{
    static $fc_nfkc_closure = array("ͺ" => " ι", "ϒ" => "υ", "ϓ" => "ύ", "ϔ" => "ϋ", "ϲ" => "σ", "Ϲ" => "σ", "ᴬ" => "a", "ᴭ" => "æ", "ᴮ" => "b", "ᴰ" => "d", "ᴱ" => "e", "ᴲ" => "ǝ", "ᴳ" => "g", "ᴴ" => "h", "ᴵ" => "i", "ᴶ" => "j", "ᴷ" => "k", "ᴸ" => "l", "ᴹ" => "m", "ᴺ" => "n", "ᴼ" => "o", "ᴽ" => "ȣ", "ᴾ" => "p", "ᴿ" => "r", "ᵀ" => "t", "ᵁ" => "u", "ᵂ" => "w", "₨" => "rs", "ℂ" => "c", "℃" => "°c", "ℇ" => "ɛ", "℉" => "°f", "ℋ" => "h", "ℌ" => "h", "ℍ" => "h", "ℐ" => "i", "ℑ" => "i", "ℒ" => "l", "ℕ" => "n", "№" => "no", "ℙ" => "p", "ℚ" => "q", "ℛ" => "r", "ℜ" => "r", "ℝ" => "r", "℠" => "sm", "℡" => "tel", "™" => "tm", "ℤ" => "z", "ℨ" => "z", "ℬ" => "b", "ℭ" => "c", "ℰ" => "e", "ℱ" => "f", "ℳ" => "m", "℻" => "fax", "ℾ" => "γ", "ℿ" => "π", "ⅅ" => "d", "㉐" => "pte", "㋌" => "hg", "㋎" => "ev", "㋏" => "ltd", "㍱" => "hpa", "㍳" => "au", "㍵" => "ov", "㍺" => "iu", "㎀" => "pa", "㎁" => "na", "㎂" => "μa", "㎃" => "ma", "㎄" => "ka", "㎅" => "kb", "㎆" => "mb", "㎇" => "gb", "㎊" => "pf", "㎋" => "nf", "㎌" => "μf", "㎐" => "hz", "㎑" => "khz", "㎒" => "mhz", "㎓" => "ghz", "㎔" => "thz", "㎩" => "pa", "㎪" => "kpa", "㎫" => "mpa", "㎬" => "gpa", "㎴" => "pv", "㎵" => "nv", "㎶" => "μv", "㎷" => "mv", "㎸" => "kv", "㎹" => "mv", "㎺" => "pw", "㎻" => "nw", "㎼" => "μw", "㎽" => "mw", "㎾" => "kw", "㎿" => "mw", "㏀" => "kω", "㏁" => "mω", "㏃" => "bq", "㏆" => "c∕kg", "㏇" => "co.", "㏈" => "db", "㏉" => "gy", "㏋" => "hp", "㏍" => "kk", "㏎" => "km", "㏗" => "ph", "㏙" => "ppm", "㏚" => "pr", "㏜" => "sv", "㏝" => "wb", "㏞" => "v∕m", "㏟" => "a∕m", "𝐀" => "a", "𝐁" => "b", "𝐂" => "c", "𝐃" => "d", "𝐄" => "e", "𝐅" => "f", "𝐆" => "g", "𝐇" => "h", "𝐈" => "i", "𝐉" => "j", "𝐊" => "k", "𝐋" => "l", "𝐌" => "m", "𝐍" => "n", "𝐎" => "o", "𝐏" => "p", "𝐐" => "q", "𝐑" => "r", "𝐒" => "s", "𝐓" => "t", "𝐔" => "u", "𝐕" => "v", "𝐖" => "w", "𝐗" => "x", "𝐘" => "y", "𝐙" => "z", "𝐴" => "a", "𝐵" => "b", "𝐶" => "c", "𝐷" => "d", "𝐸" => "e", "𝐹" => "f", "𝐺" => "g", "𝐻" => "h", "𝐼" => "i", "𝐽" => "j", "𝐾" => "k", "𝐿" => "l", "𝑀" => "m", "𝑁" => "n", "𝑂" => "o", "𝑃" => "p", "𝑄" => "q", "𝑅" => "r", "𝑆" => "s", "𝑇" => "t", "𝑈" => "u", "𝑉" => "v", "𝑊" => "w", "𝑋" => "x", "𝑌" => "y", "𝑍" => "z", "𝑨" => "a", "𝑩" => "b", "𝑪" => "c", "𝑫" => "d", "𝑬" => "e", "𝑭" => "f", "𝑮" => "g", "𝑯" => "h", "𝑰" => "i", "𝑱" => "j", "𝑲" => "k", "𝑳" => "l", "𝑴" => "m", "𝑵" => "n", "𝑶" => "o", "𝑷" => "p", "𝑸" => "q", "𝑹" => "r", "𝑺" => "s", "𝑻" => "t", "𝑼" => "u", "𝑽" => "v", "𝑾" => "w", "𝑿" => "x", "𝒀" => "y", "𝒁" => "z", "𝒜" => "a", "𝒞" => "c", "𝒟" => "d", "𝒢" => "g", "𝒥" => "j", "𝒦" => "k", "𝒩" => "n", "𝒪" => "o", "𝒫" => "p", "𝒬" => "q", "𝒮" => "s", "𝒯" => "t", "𝒰" => "u", "𝒱" => "v", "𝒲" => "w", "𝒳" => "x", "𝒴" => "y", "𝒵" => "z", "𝓐" => "a", "𝓑" => "b", "𝓒" => "c", "𝓓" => "d", "𝓔" => "e", "𝓕" => "f", "𝓖" => "g", "𝓗" => "h", "𝓘" => "i", "𝓙" => "j", "𝓚" => "k", "𝓛" => "l", "𝓜" => "m", "𝓝" => "n", "𝓞" => "o", "𝓟" => "p", "𝓠" => "q", "𝓡" => "r", "𝓢" => "s", "𝓣" => "t", "𝓤" => "u", "𝓥" => "v", "𝓦" => "w", "𝓧" => "x", "𝓨" => "y", "𝓩" => "z", "𝔄" => "a", "𝔅" => "b", "𝔇" => "d", "𝔈" => "e", "𝔉" => "f", "𝔊" => "g", "𝔍" => "j", "𝔎" => "k", "𝔏" => "l", "𝔐" => "m", "𝔑" => "n", "𝔒" => "o", "𝔓" => "p", "𝔔" => "q", "𝔖" => "s", "𝔗" => "t", "𝔘" => "u", "𝔙" => "v", "𝔚" => "w", "𝔛" => "x", "𝔜" => "y", "𝔸" => "a", "𝔹" => "b", "𝔻" => "d", "𝔼" => "e", "𝔽" => "f", "𝔾" => "g", "𝕀" => "i", "𝕁" => "j", "𝕂" => "k", "𝕃" => "l", "𝕄" => "m", "𝕆" => "o", "𝕊" => "s", "𝕋" => "t", "𝕌" => "u", "𝕍" => "v", "𝕎" => "w", "𝕏" => "x", "𝕐" => "y", "𝕬" => "a", "𝕭" => "b", "𝕮" => "c", "𝕯" => "d", "𝕰" => "e", "𝕱" => "f", "𝕲" => "g", "𝕳" => "h", "𝕴" => "i", "𝕵" => "j", "𝕶" => "k", "𝕷" => "l", "𝕸" => "m", "𝕹" => "n", "𝕺" => "o", "𝕻" => "p", "𝕼" => "q", "𝕽" => "r", "𝕾" => "s", "𝕿" => "t", "𝖀" => "u", "𝖁" => "v", "𝖂" => "w", "𝖃" => "x", "𝖄" => "y", "𝖅" => "z", "𝖠" => "a", "𝖡" => "b", "𝖢" => "c", "𝖣" => "d", "𝖤" => "e", "𝖥" => "f", "𝖦" => "g", "𝖧" => "h", "𝖨" => "i", "𝖩" => "j", "𝖪" => "k", "𝖫" => "l", "𝖬" => "m", "𝖭" => "n", "𝖮" => "o", "𝖯" => "p", "𝖰" => "q", "𝖱" => "r", "𝖲" => "s", "𝖳" => "t", "𝖴" => "u", "𝖵" => "v", "𝖶" => "w", "𝖷" => "x", "𝖸" => "y", "𝖹" => "z", "𝗔" => "a", "𝗕" => "b", "𝗖" => "c", "𝗗" => "d", "𝗘" => "e", "𝗙" => "f", "𝗚" => "g", "𝗛" => "h", "𝗜" => "i", "𝗝" => "j", "𝗞" => "k", "𝗟" => "l", "𝗠" => "m", "𝗡" => "n", "𝗢" => "o", "𝗣" => "p", "𝗤" => "q", "𝗥" => "r", "𝗦" => "s", "𝗧" => "t", "𝗨" => "u", "𝗩" => "v", "𝗪" => "w", "𝗫" => "x", "𝗬" => "y", "𝗭" => "z", "𝘈" => "a", "𝘉" => "b", "𝘊" => "c", "𝘋" => "d", "𝘌" => "e", "𝘍" => "f", "𝘎" => "g", "𝘏" => "h", "𝘐" => "i", "𝘑" => "j", "𝘒" => "k", "𝘓" => "l", "𝘔" => "m", "𝘕" => "n", "𝘖" => "o", "𝘗" => "p", "𝘘" => "q", "𝘙" => "r", "𝘚" => "s", "𝘛" => "t", "𝘜" => "u", "𝘝" => "v", "𝘞" => "w", "𝘟" => "x", "𝘠" => "y", "𝘡" => "z", "𝘼" => "a", "𝘽" => "b", "𝘾" => "c", "𝘿" => "d", "𝙀" => "e", "𝙁" => "f", "𝙂" => "g", "𝙃" => "h", "𝙄" => "i", "𝙅" => "j", "𝙆" => "k", "𝙇" => "l", "𝙈" => "m", "𝙉" => "n", "𝙊" => "o", "𝙋" => "p", "𝙌" => "q", "𝙍" => "r", "𝙎" => "s", "𝙏" => "t", "𝙐" => "u", "𝙑" => "v", "𝙒" => "w", "𝙓" => "x", "𝙔" => "y", "𝙕" => "z", "𝙰" => "a", "𝙱" => "b", "𝙲" => "c", "𝙳" => "d", "𝙴" => "e", "𝙵" => "f", "𝙶" => "g", "𝙷" => "h", "𝙸" => "i", "𝙹" => "j", "𝙺" => "k", "𝙻" => "l", "𝙼" => "m", "𝙽" => "n", "𝙾" => "o", "𝙿" => "p", "𝚀" => "q", "𝚁" => "r", "𝚂" => "s", "𝚃" => "t", "𝚄" => "u", "𝚅" => "v", "𝚆" => "w", "𝚇" => "x", "𝚈" => "y", "𝚉" => "z", "𝚨" => "α", "𝚩" => "β", "𝚪" => "γ", "𝚫" => "δ", "𝚬" => "ε", "𝚭" => "ζ", "𝚮" => "η", "𝚯" => "θ", "𝚰" => "ι", "𝚱" => "κ", "𝚲" => "λ", "𝚳" => "μ", "𝚴" => "ν", "𝚵" => "ξ", "𝚶" => "ο", "𝚷" => "π", "𝚸" => "ρ", "𝚹" => "θ", "𝚺" => "σ", "𝚻" => "τ", "𝚼" => "υ", "𝚽" => "φ", "𝚾" => "χ", "𝚿" => "ψ", "𝛀" => "ω", "𝛓" => "σ", "𝛢" => "α", "𝛣" => "β", "𝛤" => "γ", "𝛥" => "δ", "𝛦" => "ε", "𝛧" => "ζ", "𝛨" => "η", "𝛩" => "θ", "𝛪" => "ι", "𝛫" => "κ", "𝛬" => "λ", "𝛭" => "μ", "𝛮" => "ν", "𝛯" => "ξ", "𝛰" => "ο", "𝛱" => "π", "𝛲" => "ρ", "𝛳" => "θ", "𝛴" => "σ", "𝛵" => "τ", "𝛶" => "υ", "𝛷" => "φ", "𝛸" => "χ", "𝛹" => "ψ", "𝛺" => "ω", "𝜍" => "σ", "𝜜" => "α", "𝜝" => "β", "𝜞" => "γ", "𝜟" => "δ", "𝜠" => "ε", "𝜡" => "ζ", "𝜢" => "η", "𝜣" => "θ", "𝜤" => "ι", "𝜥" => "κ", "𝜦" => "λ", "𝜧" => "μ", "𝜨" => "ν", "𝜩" => "ξ", "𝜪" => "ο", "𝜫" => "π", "𝜬" => "ρ", "𝜭" => "θ", "𝜮" => "σ", "𝜯" => "τ", "𝜰" => "υ", "𝜱" => "φ", "𝜲" => "χ", "𝜳" => "ψ", "𝜴" => "ω", "𝝇" => "σ", "𝝖" => "α", "𝝗" => "β", "𝝘" => "γ", "𝝙" => "δ", "𝝚" => "ε", "𝝛" => "ζ", "𝝜" => "η", "𝝝" => "θ", "𝝞" => "ι", "𝝟" => "κ", "𝝠" => "λ", "𝝡" => "μ", "𝝢" => "ν", "𝝣" => "ξ", "𝝤" => "ο", "𝝥" => "π", "𝝦" => "ρ", "𝝧" => "θ", "𝝨" => "σ", "𝝩" => "τ", "𝝪" => "υ", "𝝫" => "φ", "𝝬" => "χ", "𝝭" => "ψ", "𝝮" => "ω", "𝞁" => "σ", "𝞐" => "α", "𝞑" => "β", "𝞒" => "γ", "𝞓" => "δ", "𝞔" => "ε", "𝞕" => "ζ", "𝞖" => "η", "𝞗" => "θ", "𝞘" => "ι", "𝞙" => "κ", "𝞚" => "λ", "𝞛" => "μ", "𝞜" => "ν", "𝞝" => "ξ", "𝞞" => "ο", "𝞟" => "π", "𝞠" => "ρ", "𝞡" => "θ", "𝞢" => "σ", "𝞣" => "τ", "𝞤" => "υ", "𝞥" => "φ", "𝞦" => "χ", "𝞧" => "ψ", "𝞨" => "ω", "𝞻" => "σ", "𝟊" => "ϝ");
    // do the case fold
    $text = utf8_new_case_fold($text, $option);
    // convert to NFKC
    $text = Normalizer::normalize($text, Normalizer::NFKC);
    // FC_NFKC_Closure, http://www.unicode.org/Public/5.0.0/ucd/DerivedNormalizationProps.txt
    $text = strtr($text, $fc_nfkc_closure);
    return $text;
}
开发者ID:bruninoit,项目名称:phpbb,代码行数:11,代码来源:confusables.php

示例14: normalize

 /**
  * @param $string
  * @return BufferInterface
  * @throws \Exception
  */
 private function normalize($string)
 {
     if (!class_exists('Normalizer')) {
         if (mb_detect_encoding($string) === 'UTF-8') {
             throw new \Exception('UTF-8 passphrase is not supported without the PECL intl extension installed.');
         } else {
             return new Buffer($string);
         }
     }
     return new Buffer(\Normalizer::normalize($string, \Normalizer::FORM_KD));
 }
开发者ID:nmarley,项目名称:bitcoin-php,代码行数:16,代码来源:Bip39SeedGenerator.php

示例15: normalize_string

function normalize_string($str)
{
    // 半角カタカナを全角カタカナにする。半角濁点の場合は濁点付き全角1文字にする。全角英数字を半角英数字にする。
    $str = mb_convert_kana($str, "KVas", "UTF-8");
    // 改行コードをPHP_EOLに統一する(セル内改行もPHP_EOLになる)。
    $str = ereg_replace("\r\n|\r|\n", PHP_EOL, $str);
    // NFDがあればNFCに正規化する。
    if (Normalizer::isNormalized($str, Normalizer::FORM_D)) {
        $str = Normalizer::normalize($str, Normalizer::FORM_C);
    }
    return $str;
}
开发者ID:amoryver,项目名称:ws-converter,代码行数:12,代码来源:utilities.php


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