當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OC_Helper::mb_substr_replace方法代碼示例

本文整理匯總了PHP中OC_Helper::mb_substr_replace方法的典型用法代碼示例。如果您正苦於以下問題:PHP OC_Helper::mb_substr_replace方法的具體用法?PHP OC_Helper::mb_substr_replace怎麽用?PHP OC_Helper::mb_substr_replace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OC_Helper的用法示例。


在下文中一共展示了OC_Helper::mb_substr_replace方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testMb_substr_replace

 function testMb_substr_replace()
 {
     $result = OC_Helper::mb_substr_replace("This  is a teststring", "string", 5);
     $expected = "This string is a teststring";
     $this->assertEquals($result, $expected);
 }
開發者ID:reverserob,項目名稱:core,代碼行數:6,代碼來源:helper.php

示例2: mb_substr_replace

 /**
  * replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement.
  *
  * @param string $string The input string. Opposite to the PHP build-in function does not accept an array.
  * @param string $replacement The replacement string.
  * @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string.
  * @param int $length Length of the part to be replaced
  * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
  * @return string
  * @since 4.5.0
  * @deprecated 8.2.0 Use substr_replace() instead.
  */
 public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8')
 {
     return \OC_Helper::mb_substr_replace($string, $replacement, $start, $length, $encoding);
 }
開發者ID:enoch85,項目名稱:owncloud-testserver,代碼行數:16,代碼來源:util.php

示例3: mb_str_replace

	/**
	 * Replace all occurrences of the search string with the replacement string
	 *
	 * @param string $search The value being searched for, otherwise known as the needle.
	 * @param string $replace The replacement
	 * @param string $subject The string or array being searched and replaced on, otherwise known as the haystack.
	 * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
	 * @param int $count If passed, this will be set to the number of replacements performed.
	 * @return string
	 *
	 */
	public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {
		$offset = -1;
		$length = mb_strlen($search, $encoding);
		while (($i = mb_strrpos($subject, $search, $offset, $encoding)) !== false) {
			$subject = OC_Helper::mb_substr_replace($subject, $replace, $i, $length);
			$offset = $i - mb_strlen($subject, $encoding);
			$count++;
		}
		return $subject;
	}
開發者ID:pombredanne,項目名稱:ArcherSys,代碼行數:21,代碼來源:helper.php


注:本文中的OC_Helper::mb_substr_replace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。