?? glib-glob-style-pattern-matching.html
字號:
<tr><td><p><span class="term"><em class="parameter"><code>pspec1</code></em> :</span></p></td><td>a <a class="link" href="glib-Glob-style-pattern-matching.html#GPatternSpec"><span class="type">GPatternSpec</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>pspec2</code></em> :</span></p></td><td>another <a class="link" href="glib-Glob-style-pattern-matching.html#GPatternSpec"><span class="type">GPatternSpec</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>Whether the compiled patterns are equal</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3141004"></a><h3><a name="g-pattern-match"></a>g_pattern_match ()</h3><a class="indexterm" name="id3141016"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> g_pattern_match (<a class="link" href="glib-Glob-style-pattern-matching.html#GPatternSpec">GPatternSpec</a> *pspec, <a class="link" href="glib-Basic-Types.html#guint">guint</a> string_length, const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *string, const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *string_reversed);</pre><p>Matches a string against a compiled pattern. Passing the correct length of the string given is mandatory. The reversed string can be omitted by passing <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, this is more efficient if the reversed version of the string to be matched is not at hand, as <a class="link" href="glib-Glob-style-pattern-matching.html#g-pattern-match"><code class="function">g_pattern_match()</code></a> will only construct it if the compiled pattern requires reverse matches.</p><p>Note that, if the user code will (possibly) match a string against a multitude of patterns containing wildcards, chances are high that some patterns will require a reversed string. In this case, it's more efficient to provide the reversed string to avoid multiple constructions thereof in the various calls to <a class="link" href="glib-Glob-style-pattern-matching.html#g-pattern-match"><code class="function">g_pattern_match()</code></a>.</p><p>Note also that the reverse of a UTF-8 encoded string can in general <span class="emphasis"><em>not</em></span> be obtained by <a class="link" href="glib-String-Utility-Functions.html#g-strreverse"><code class="function">g_strreverse()</code></a>. This works only if the string doesn't contain any multibyte characters. GLib offers the <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strreverse"><code class="function">g_utf8_strreverse()</code></a> function to reverse UTF-8 encoded strings.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>pspec</code></em> :</span></p></td><td>a <a class="link" href="glib-Glob-style-pattern-matching.html#GPatternSpec"><span class="type">GPatternSpec</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>string_length</code></em> :</span></p></td><td>the length of <em class="parameter"><code>string</code></em> (in bytes, i.e. <code class="function">strlen()</code>, <span class="emphasis"><em>not</em></span> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strlen"><code class="function">g_utf8_strlen()</code></a>)</td></tr><tr><td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td><td>the UTF-8 encoded string to match</td></tr><tr><td><p><span class="term"><em class="parameter"><code>string_reversed</code></em> :</span></p></td><td>the reverse of <em class="parameter"><code>string</code></em> or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>string</code></em> matches <em class="parameter"><code>pspec</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3141291"></a><h3><a name="g-pattern-match-string"></a>g_pattern_match_string ()</h3><a class="indexterm" name="id3141304"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> g_pattern_match_string (<a class="link" href="glib-Glob-style-pattern-matching.html#GPatternSpec">GPatternSpec</a> *pspec, const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *string);</pre><p>Matches a string against a compiled pattern. If the string is to be matched against more than one pattern, consider using <a class="link" href="glib-Glob-style-pattern-matching.html#g-pattern-match"><code class="function">g_pattern_match()</code></a> instead while supplying the reversed string.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>pspec</code></em> :</span></p></td><td>a <a class="link" href="glib-Glob-style-pattern-matching.html#GPatternSpec"><span class="type">GPatternSpec</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td><td>the UTF-8 encoded string to match</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>string</code></em> matches <em class="parameter"><code>pspec</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3141425"></a><h3><a name="g-pattern-match-simple"></a>g_pattern_match_simple ()</h3><a class="indexterm" name="id3141438"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> g_pattern_match_simple (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *pattern, const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *string);</pre><p>Matches a string against a pattern given as a string.If this function is to be called in a loop, it's more efficient to compilethe pattern once with <a class="link" href="glib-Glob-style-pattern-matching.html#g-pattern-spec-new"><code class="function">g_pattern_spec_new()</code></a> and call <a class="link" href="glib-Glob-style-pattern-matching.html#g-pattern-match-string"><code class="function">g_pattern_match_string()</code></a>repeatedly.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>pattern</code></em> :</span></p></td><td>the UTF-8 encoded pattern</td></tr><tr><td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td><td>the UTF-8 encoded string to match</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>string</code></em> matches <em class="parameter"><code>pspec</code></em></td></tr></tbody></table></div></div></div><div class="refsect1" lang="en"><a name="id3141564"></a><div class="refsect2" lang="en"><a name="id3141565"></a></div><hr><div class="refsect2" lang="en"><a name="id3141566"></a></div></div></div></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -