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


PHP mb_strripos函数代码示例

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


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

示例1: testmb_strpos

 /**
  * @covers Patchwork\PHP\Override\Mbstring::mb_strpos
  * @covers Patchwork\PHP\Override\Mbstring::mb_stripos
  * @covers Patchwork\PHP\Override\Mbstring::mb_strrpos
  * @covers Patchwork\PHP\Override\Mbstring::mb_strripos
  */
 function testmb_strpos()
 {
     $this->assertSame(false, @mb_strpos('abc', ''));
     $this->assertSame(false, @mb_strpos('abc', 'a', -1));
     $this->assertSame(false, mb_strpos('abc', 'd'));
     $this->assertSame(false, mb_strpos('abc', 'a', 3));
     $this->assertSame(1, mb_strpos('한국어', '국'));
     $this->assertSame(3, mb_stripos('DÉJÀ', 'à'));
     $this->assertSame(false, mb_strrpos('한국어', ''));
     $this->assertSame(1, mb_strrpos('한국어', '국'));
     $this->assertSame(3, mb_strripos('DÉJÀ', 'à'));
     $this->assertSame(1, mb_stripos('aςσb', 'ΣΣ'));
     $this->assertSame(1, mb_strripos('aςσb', 'ΣΣ'));
     $this->assertSame(false, @p::mb_strpos('abc', ''));
     $this->assertSame(false, @p::mb_strpos('abc', 'a', -1));
     $this->assertSame(false, p::mb_strpos('abc', 'd'));
     $this->assertSame(false, p::mb_strpos('abc', 'a', 3));
     $this->assertSame(1, p::mb_strpos('한국어', '국'));
     $this->assertSame(3, p::mb_stripos('DÉJÀ', 'à'));
     $this->assertSame(false, p::mb_strrpos('한국어', ''));
     $this->assertSame(1, p::mb_strrpos('한국어', '국'));
     $this->assertSame(3, p::mb_strripos('DÉJÀ', 'à'));
     $this->assertSame(1, p::mb_stripos('aςσb', 'ΣΣ'));
     $this->assertSame(1, p::mb_strripos('aςσb', 'ΣΣ'));
 }
开发者ID:nicolas-grekas,项目名称:Patchwork-sandbox,代码行数:31,代码来源:MbstringTest.php

示例2: validateEquals

 protected function validateEquals($input)
 {
     if (is_array($input)) {
         return end($input) == $this->endValue;
     }
     return mb_strripos($input, $this->endValue, -1, $enc = mb_detect_encoding($input)) === mb_strlen($input, $enc) - mb_strlen($this->endValue, $enc);
 }
开发者ID:dez-php,项目名称:Validation,代码行数:7,代码来源:EndsWith.php

示例3: execute

 /**
  * LastIndexOf
  */
 public function execute()
 {
     if ($this->isCaseInsensitive()) {
         return mb_strripos($this->getValue(), $this->needle, $this->fromIndex);
     } else {
         return mb_strrpos($this->getValue(), $this->needle, $this->fromIndex);
     }
 }
开发者ID:jasonlam604,项目名称:stringizer,代码行数:11,代码来源:LastIndexOf.php

示例4: formatShortString

 public function formatShortString($string, $maxlen = 200, $separator = '...')
 {
     $string = preg_replace('#<(?:br|p|hr|div)#', ' $0', $string);
     $string = strip_tags($string);
     $len = mb_strlen($string, 'UTF-8') > $maxlen ? mb_strripos(mb_substr($string, 0, $maxlen, 'UTF-8'), ' ', 0, 'UTF-8') : $maxlen;
     $cutStr = mb_substr($string, 0, $len, 'UTF-8');
     return mb_strlen($string, 'UTF-8') > $maxlen ? '' . $cutStr . $separator : '' . $cutStr . '';
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:8,代码来源:RecommendationCompanyWidget.php

示例5: cutString

function cutString($string, $maxlen)
{
    //обрезает красиво строку, убирает теги, добавляя ... в конце
    $string = strip_tags($string);
    $len = mb_strlen($string) > $maxlen ? mb_strripos(mb_substr($string, 0, $maxlen), ' ') : $maxlen;
    $cutStr = mb_substr($string, 0, $len);
    return mb_strlen($string) > $maxlen ? $cutStr . '...' : $cutStr;
}
开发者ID:arestotel,项目名称:project,代码行数:8,代码来源:func.php

示例6: utf8_strripos

 public static function utf8_strripos($haystack, $needle, $offset)
 {
     if (UTF8_MBSTRING) {
         self::_fixMbStrrposPhp52($haystack, $offset);
         return mb_strripos($haystack, $needle, $offset);
     } else {
         return strripos($haystack, $needle, $offset);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:9,代码来源:Helper.php

示例7: injectEditor

 /**
  * @param Response $response
  * @param string   $editorHtml
  */
 private function injectEditor(Response $response, $editorHtml)
 {
     $html = $response->getContent();
     $pos = mb_strripos($html, '</body>');
     if (false === $pos) {
         return;
     }
     $html = mb_substr($html, 0, $pos) . $editorHtml . mb_substr($html, $pos);
     $response->setContent($html);
 }
开发者ID:ivoaz,项目名称:content-editable-bundle,代码行数:14,代码来源:EditorResponseListener.php

示例8: injectCookieBar

 protected function injectCookieBar(Response $response)
 {
     $content = $response->getContent();
     $pos = mb_strripos($content, '</body>');
     if (false !== $pos) {
         $toolbar = sprintf("\n%s\n", $this->cookieService->render());
         $content = mb_substr($content, 0, $pos) . $toolbar . mb_substr($content, $pos);
         $response->setContent($content);
     }
 }
开发者ID:vladab,项目名称:cookie-acknowledgement-bundle,代码行数:10,代码来源:CookieAcknowledgementBarListener.php

示例9: fixEmbeddedAttachments

 protected function fixEmbeddedAttachments($message, $oldID, $newID)
 {
     if (mb_strripos($message, '[attach]' . $oldID . '[/attach]') !== false || mb_strripos($message, '[attach=' . $oldID . ']') !== false || mb_strripos($message, '[attach=' . $oldID . ',') !== false) {
         $message = str_ireplace('[attach]' . $oldID . '[/attach]', '[attach]' . $newID . '[/attach]', $message);
         $message = str_ireplace('[attach=' . $oldID . ']', '[attach=' . $newID . ']', $message);
         $message = str_ireplace('[attach=' . $oldID . ',', '[attach=' . $newID . ',', $message);
         return $message;
     }
     return false;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:10,代码来源:AbstractAttachmentImporter.class.php

示例10: get_words

 /**
  * Генерация слов по которым найдена акция
  * @param $news
  * @return $this
  */
 public function get_words($news)
 {
     $words = array();
     foreach ($this->_original_words as $word) {
         if (mb_strripos($news->title, $word) !== FALSE or mb_strripos($news->text, $word) !== FALSE) {
             $words[] = $word;
         }
     }
     $words = array_unique($words);
     return View::factory('frontend/search/search_words')->set('words', $words);
 }
开发者ID:Alexander711,项目名称:naav1,代码行数:16,代码来源:stock.php

示例11: mb_trim_word

 /**
  * Обрезание текста по длине с поиском последнего полностью вмещающегося слова и удалением лишних крайних знаков пунктуации.
  *
  * @author Agel_Nash <Agel_Nash@xaker.ru>
  * @version 0.1
  *
  * @param string $html HTML текст
  * @param integer $len максимальная длина строки
  * @param string $encoding кодировка
  * @return string
  */
 public static function mb_trim_word($html, $len, $encoding = 'UTF-8')
 {
     $text = trim(preg_replace('|\\s+|', ' ', strip_tags($html)));
     $text = mb_substr($text, 0, $len + 1, $encoding);
     if (mb_substr($text, -1, null, $encoding) == ' ') {
         $out = trim($text);
     } else {
         $out = mb_substr($text, 0, mb_strripos($text, ' ', null, $encoding), $encoding);
     }
     return preg_replace("/(([\\.,\\-:!?;\\s])|(&\\w+;))+\$/ui", "", $out);
 }
开发者ID:AgelxNash,项目名称:modx.evo.custom,代码行数:22,代码来源:APIHelpers.class.php

示例12: injectToolbar

 /**
  * @param \Symfony\Component\HttpFoundation\Response $response
  */
 protected function injectToolbar(Response $response)
 {
     $content = $response->getContent();
     $pos = mb_strripos($content, '</body>');
     if (FALSE !== $pos) {
         if ($token = $response->headers->get('X-Debug-Token')) {
             $loader = ['#theme' => 'webprofiler_loader', '#token' => $token, '#profiler_url' => $this->urlGenerator->generate('webprofiler.toolbar', ['profile' => $token])];
             $content = mb_substr($content, 0, $pos) . $this->renderer->renderRoot($loader) . mb_substr($content, $pos);
             $response->setContent($content);
         }
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:15,代码来源:WebprofilerEventSubscriber.php

示例13: xyz_fbap_string_limit

 function xyz_fbap_string_limit($string, $limit)
 {
     $space = " ";
     $appendstr = " ...";
     if (mb_strlen($string) <= $limit) {
         return $string;
     }
     if (mb_strlen($appendstr) >= $limit) {
         return '';
     }
     $string = mb_substr($string, 0, $limit - mb_strlen($appendstr));
     $rpos = mb_strripos($string, $space);
     if ($rpos === false) {
         return $string . $appendstr;
     } else {
         return mb_substr($string, 0, $rpos) . $appendstr;
     }
 }
开发者ID:bichttn,项目名称:bichttn,代码行数:18,代码来源:xyz-functions.php

示例14: softCut

 /**
  * Soft cutting for string
  * 
  * @param   string  $string     Source string
  * @param   integer $soft       Soft cutting position
  * @param   integer $hard       Hard cutting position
  * @param   integer $strategy   Cutting strategy [optional]
  * @param   boolean $strip      Strip tags in source [optional]
  * @param   string  $encoding   Source encoding [optional]
  * @return  string  Cutted string
  */
 public static function softCut($string, $soft, $hard, $strategy = self::CUT_STRATEGY_MIN, $strip = true, $encoding = 'utf-8')
 {
     if ($strip) {
         $string = strip_tags($string);
     }
     if (mb_strlen($string) <= $soft) {
         return $string;
     }
     $cut = mb_substr($string, 0, $hard, $encoding);
     $pos = $strategy == self::CUT_STRATEGY_MIN ? mb_stripos($cut, ' ', $soft, $encoding) : mb_strripos($cut, ' ', $soft, $encoding);
     if ($pos === false) {
         $pos = $strategy == self::CUT_STRATEGY_MIN ? mb_stripos($cut, '&nbsp;', $soft, $encoding) : mb_strripos($cut, '&nbsp;', $soft, $encoding);
     }
     if ($pos === false) {
         $pos = $strategy == self::CUT_STRATEGY_MIN ? mb_stripos($cut, ' ', $soft, $encoding) : mb_strripos($cut, ' ', $soft, $encoding);
     }
     if ($pos === false) {
         return $cut;
     }
     return mb_substr($string, 0, $pos, $encoding);
 }
开发者ID:relo-san,项目名称:dinSymfonyExtraPlugin,代码行数:32,代码来源:DinFormatHelper.php

示例15: grapheme_position

 private static function grapheme_position($s, $needle, $offset, $mode)
 {
     if (!preg_match('/./us', $needle .= '')) {
         return false;
     }
     if (!preg_match('/./us', $s .= '')) {
         return false;
     }
     if ($offset > 0) {
         $s = self::grapheme_substr($s, $offset);
     } elseif ($offset < 0) {
         $offset = 0;
     }
     switch ($mode) {
         case 0:
             $needle = iconv_strpos($s, $needle, 0, 'UTF-8');
             break;
         case 1:
             $needle = mb_stripos($s, $needle, 0, 'UTF-8');
             break;
         case 2:
             $needle = iconv_strrpos($s, $needle, 'UTF-8');
             break;
         default:
             $needle = mb_strripos($s, $needle, 0, 'UTF-8');
             break;
     }
     return $needle ? self::grapheme_strlen(iconv_substr($s, 0, $needle, 'UTF-8')) + $offset : $needle;
 }
开发者ID:roberto-sanchez,项目名称:gardencentral,代码行数:29,代码来源:Intl.php


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