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


PHP Utf8::strtolower方法代码示例

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


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

示例1: urlSafe

 /**
  * Convert a string to a URL safe string
  *
  * @param  string $str
  * @param  array  $replace
  * @param  string $separator
  * @return string
  */
 protected function urlSafe($str, $replace = array(), $separator = '-')
 {
     if (!empty($replace)) {
         $str = str_replace((array) $replace, ' ', $str);
     }
     // Transliterate non-ASCII characters
     // $str = UTF8::transliterate_to_ascii($str);
     // Remove all characters that are not the separator, a-z, 0-9, or whitespace
     $str = preg_replace('![^' . preg_quote($separator) . 'a-z0-9\\s]+!', '', UTF8::strtolower($str));
     // Replace all separator characters and whitespace by a single separator
     $str = preg_replace('![' . preg_quote($separator) . '\\s]+!u', $separator, $str);
     // Trim separators from the beginning and end
     return trim($str, $separator);
 }
开发者ID:abhishekchaudhary996,项目名称:auto-generating-gallery,代码行数:22,代码来源:ImageManager.php

示例2: testStrCase

 /**
  * @covers Patchwork\Utf8::strtolower
  * @covers Patchwork\Utf8::strtoupper
  */
 function testStrCase()
 {
     $this->assertSame('déjà σσς', u::strtolower('DÉJÀ Σσς'));
     $this->assertSame('DÉJÀ ΣΣΣ', u::strtoupper('Déjà Σσς'));
 }
开发者ID:nicolas-grekas,项目名称:Patchwork-sandbox,代码行数:9,代码来源:Utf8Test.php

示例3: api_strtolower

/**
 * Makes a string lowercase.
 * @param string $string				The string being lowercased.
 * @param string $encoding (optional)	The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
 * @return string						Returns the string with all alphabetic characters converted to lowercase.
 * This function is aimed at replacing the functions strtolower() and mb_strtolower() for human-language strings.
 * @link http://php.net/manual/en/function.strtolower
 * @link http://php.net/manual/en/function.mb-strtolower
 */
function api_strtolower($string, $encoding = null)
{
    return Utf8::strtolower($string);
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:13,代码来源:internationalization.lib.php

示例4: lower

 public function lower()
 {
     $this->string = u::strtolower($this->string);
     return $this;
 }
开发者ID:robclancy,项目名称:string,代码行数:5,代码来源:String.php

示例5: utf8_strtolower

/**
 * Make a string lowercase
 *
 * @param string $str
 *
 * @return string
 *
 * @deprecated Deprecated since Contao 4.0, to be removed in Contao 5.0.
 *             Use Patchwork\Utf8::strtolower() instead.
 */
function utf8_strtolower($str)
{
    @trigger_error('Using utf8_strtolower() has been deprecated and will no longer work in Contao 5.0. Use Patchwork\\Utf8::strtolower() instead.', E_USER_DEPRECATED);
    return Utf8::strtolower($str);
}
开发者ID:contao,项目名称:core-bundle,代码行数:15,代码来源:functions.php

示例6: searchFor

 /**
  * Search the index and return the result object
  *
  * @param string  $strKeywords The keyword string
  * @param boolean $blnOrSearch If true, the result can contain any keyword
  * @param array   $arrPid      An optional array of page IDs to limit the result to
  * @param integer $intRows     An optional maximum number of result rows
  * @param integer $intOffset   An optional result offset
  * @param boolean $blnFuzzy    If true, the search will be fuzzy
  *
  * @return Database\Result The database result object
  *
  * @throws \Exception If the cleaned keyword string is empty
  */
 public static function searchFor($strKeywords, $blnOrSearch = false, $arrPid = array(), $intRows = 0, $intOffset = 0, $blnFuzzy = false)
 {
     // Clean the keywords
     $strKeywords = Utf8::strtolower($strKeywords);
     $strKeywords = \StringUtil::decodeEntities($strKeywords);
     $strKeywords = preg_replace(array('/\\. /', '/\\.$/', '/: /', '/:$/', '/, /', '/,$/', '/[^\\w\' *+".:,-]/u'), ' ', $strKeywords);
     // Check keyword string
     if (!strlen($strKeywords)) {
         throw new \Exception('Empty keyword string');
     }
     // Split keywords
     $arrChunks = array();
     preg_match_all('/"[^"]+"|[\\+\\-]?[^ ]+\\*?/', $strKeywords, $arrChunks);
     $arrPhrases = array();
     $arrKeywords = array();
     $arrWildcards = array();
     $arrIncluded = array();
     $arrExcluded = array();
     foreach ($arrChunks[0] as $strKeyword) {
         if (substr($strKeyword, -1) == '*' && strlen($strKeyword) > 1) {
             $arrWildcards[] = str_replace('*', '%', $strKeyword);
             continue;
         }
         switch (substr($strKeyword, 0, 1)) {
             // Phrases
             case '"':
                 if (($strKeyword = trim(substr($strKeyword, 1, -1))) != false) {
                     $arrPhrases[] = '[[:<:]]' . str_replace(array(' ', '*'), array('[^[:alnum:]]+', ''), $strKeyword) . '[[:>:]]';
                 }
                 break;
                 // Included keywords
             // Included keywords
             case '+':
                 if (($strKeyword = trim(substr($strKeyword, 1))) != false) {
                     $arrIncluded[] = $strKeyword;
                 }
                 break;
                 // Excluded keywords
             // Excluded keywords
             case '-':
                 if (($strKeyword = trim(substr($strKeyword, 1))) != false) {
                     $arrExcluded[] = $strKeyword;
                 }
                 break;
                 // Wildcards
             // Wildcards
             case '*':
                 if (strlen($strKeyword) > 1) {
                     $arrWildcards[] = str_replace('*', '%', $strKeyword);
                 }
                 break;
                 // Normal keywords
             // Normal keywords
             default:
                 $arrKeywords[] = $strKeyword;
                 break;
         }
     }
     // Fuzzy search
     if ($blnFuzzy) {
         foreach ($arrKeywords as $strKeyword) {
             $arrWildcards[] = '%' . $strKeyword . '%';
         }
         $arrKeywords = array();
     }
     // Count keywords
     $intPhrases = count($arrPhrases);
     $intWildcards = count($arrWildcards);
     $intIncluded = count($arrIncluded);
     $intExcluded = count($arrExcluded);
     $intKeywords = 0;
     $arrValues = array();
     // Remember found words so we can highlight them later
     $strQuery = "SELECT tl_search_index.pid AS sid, GROUP_CONCAT(word) AS matches";
     // Get the number of wildcard matches
     if (!$blnOrSearch && $intWildcards) {
         $strQuery .= ", (SELECT COUNT(*) FROM tl_search_index WHERE (" . implode(' OR ', array_fill(0, $intWildcards, 'word LIKE ?')) . ") AND pid=sid) AS wildcards";
         $arrValues = array_merge($arrValues, $arrWildcards);
     }
     // Count the number of matches
     $strQuery .= ", COUNT(*) AS count";
     // Get the relevance
     $strQuery .= ", SUM(relevance) AS relevance";
     // Get meta information from tl_search
     $strQuery .= ", tl_search.*";
     // see #4506
//.........这里部分代码省略.........
开发者ID:contao,项目名称:core-bundle,代码行数:101,代码来源:Search.php


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