當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。