uTools-Manuals/docs/php/grapheme_strstr.html
2019-04-08 23:22:26 +08:00

126 lines
6.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Returns part of haystack string from the first occurrence of needle to the end of haystack</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.grapheme-strstr" class="refentry">
<div class="refnamediv">
<h1 class="refname">grapheme_strstr</h1>
<p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PECL intl &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">grapheme_strstr</span> &mdash; <span class="dc-title">Returns part of haystack string from the first occurrence of needle to the end of haystack</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.grapheme-strstr-description">
<h3 class="title">说明</h3>
<p class="para">过程化风格</p>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>grapheme_strstr</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$haystack</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$needle</code></span>
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$before_needle</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span>
] ) : <span class="type">string</span></div>
<p class="para rdfs-comment">
Returns part of haystack string from the first occurrence of needle to the end of haystack (including the needle).
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.grapheme-strstr-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">haystack</code></dt>
<dd>
<p class="para">
The input string. Must be valid UTF-8.
</p>
</dd>
<dt>
<code class="parameter">needle</code></dt>
<dd>
<p class="para">
The string to look for. Must be valid UTF-8.
</p>
</dd>
<dt>
<code class="parameter">before_needle</code></dt>
<dd>
<p class="para">
If <strong><code>TRUE</code></strong>, grapheme_strstr() returns the part of the
haystack before the first occurrence of the needle (excluding the needle).
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.grapheme-strstr-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns the portion of string, or FALSE if needle is not found.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.grapheme-strstr-examples">
<h3 class="title">范例</h3>
<div class="example" id="example-3100">
<p><strong>Example #1 <span class="function"><strong>grapheme_strstr()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$char_a_ring_nfd&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"a\xCC\x8A"</span><span style="color: #007700">;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;'LATIN&nbsp;SMALL&nbsp;LETTER&nbsp;A&nbsp;WITH&nbsp;RING&nbsp;ABOVE'&nbsp;(U+00E5)&nbsp;normalization&nbsp;form&nbsp;"D"<br /></span><span style="color: #0000BB">$char_o_diaeresis_nfd&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"o\xCC\x88"</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;'LATIN&nbsp;SMALL&nbsp;LETTER&nbsp;O&nbsp;WITH&nbsp;DIAERESIS'&nbsp;(U+00F6)&nbsp;normalization&nbsp;form&nbsp;"D"<br /><br /></span><span style="color: #007700">print&nbsp;</span><span style="color: #0000BB">urlencode</span><span style="color: #007700">(</span><span style="color: #0000BB">grapheme_stristr</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$char_a_ring_nfd&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$char_o_diaeresis_nfd&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$char_a_ring_nfd</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$char_o_diaeresis_nfd</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
<p class="para">以上例程会输出:</p>
<div class="example-contents screen">
<div class="cdata"><pre>
o%CC%88a%CC%8A
</pre></div>
</div>
</div>
<div class="refsect1 seealso" id="refsect1-function.grapheme-strstr-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="grapheme_stristr.html" class="function" rel="rdfs-seeAlso">grapheme_stristr()</a> - Returns part of haystack string from the first occurrence of case-insensitive needle to the end of haystack</span></li>
<li class="member"><span class="function"><a href="grapheme_stripos.html" class="function" rel="rdfs-seeAlso">grapheme_stripos()</a> - Find position (in grapheme units) of first occurrence of a case-insensitive string</span></li>
<li class="member"><span class="function"><a href="grapheme_strpos.html" class="function" rel="rdfs-seeAlso">grapheme_strpos()</a> - Find position (in grapheme units) of first occurrence of a string</span></li>
<li class="member"><span class="function"><a href="grapheme_strripos.html" class="function" rel="rdfs-seeAlso">grapheme_strripos()</a> - Find position (in grapheme units) of last occurrence of a case-insensitive string</span></li>
<li class="member"><span class="function"><a href="grapheme_strrpos.html" class="function" rel="rdfs-seeAlso">grapheme_strrpos()</a> - Find position (in grapheme units) of last occurrence of a string</span></li>
<li class="member">
<a href="http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries" class="link external">&raquo;&nbsp;
Unicode Text Segmentation: Grapheme Cluster Boundaries
</a>
</li>
</ul>
</p>
</div>
</div></div></div></body></html>