⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-unicode-manipulation.html

📁 glid编写实例
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> the resulting character. If <em class="parameter"><code>p</code></em> points to a partial   sequence at the end of a string that could begin a valid    character, returns (gunichar)-2; otherwise, if <em class="parameter"><code>p</code></em> does not point    to a valid UTF-8 encoded Unicode character, returns (gunichar)-1.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2973907"></a><h3><a name="g-utf8-offset-to-pointer"></a>g_utf8_offset_to_pointer ()</h3><a class="indexterm" name="id2973918"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_utf8_offset_to_pointer        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,                                             <a href="glib-Basic-Types.html#glong">glong</a> offset);</pre><p>Converts from an integer character offset to a pointer to a positionwithin the string.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td><td> a UTF-8 encoded string</td></tr><tr><td><span class="term"><em class="parameter"><code>offset</code></em>&#160;:</span></td><td> a character offset within <em class="parameter"><code>str</code></em></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> the resulting pointer</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2974008"></a><h3><a name="g-utf8-pointer-to-offset"></a>g_utf8_pointer_to_offset ()</h3><a class="indexterm" name="id2974019"></a><pre class="programlisting"><a href="glib-Basic-Types.html#glong">glong</a>       g_utf8_pointer_to_offset        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *pos);</pre><p>Converts from a pointer to position within a string to a integercharacter offset.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td><td> a UTF-8 encoded string</td></tr><tr><td><span class="term"><em class="parameter"><code>pos</code></em>&#160;:</span></td><td> a pointer to a position within <em class="parameter"><code>str</code></em></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> the resulting character offset</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2974108"></a><h3><a name="g-utf8-prev-char"></a>g_utf8_prev_char ()</h3><a class="indexterm" name="id2974119"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_utf8_prev_char                (const <a href="glib-Basic-Types.html#gchar">gchar</a> *p);</pre><p>Finds the previous UTF-8 character in the string before <em class="parameter"><code>p</code></em>.</p><p><em class="parameter"><code>p</code></em> does not have to be at the beginning of a UTF-8 character. No checkis made to see if the character found is actually valid other thanit starts with an appropriate byte. If <em class="parameter"><code>p</code></em> might be the firstcharacter of the string, you must use <a href="glib-Unicode-Manipulation.html#g-utf8-find-prev-char"><code class="function">g_utf8_find_prev_char()</code></a> instead.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>p</code></em>&#160;:</span></td><td> a pointer to a position within a UTF-8 encoded string</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> a pointer to the found character.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2974215"></a><h3><a name="g-utf8-find-next-char"></a>g_utf8_find_next_char ()</h3><a class="indexterm" name="id2974226"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_utf8_find_next_char           (const <a href="glib-Basic-Types.html#gchar">gchar</a> *p,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *end);</pre><p>Finds the start of the next UTF-8 character in the string after <em class="parameter"><code>p</code></em>.</p><p><em class="parameter"><code>p</code></em> does not have to be at the beginning of a UTF-8 character. No checkis made to see if the character found is actually valid other thanit starts with an appropriate byte.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>p</code></em>&#160;:</span></td><td> a pointer to a position within a UTF-8 encoded string</td></tr><tr><td><span class="term"><em class="parameter"><code>end</code></em>&#160;:</span></td><td> a pointer to the end of the string, or <code class="literal">NULL</code> to indicate       that the string is nul-terminated, in which case       the returned value will be </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> a pointer to the found character or <code class="literal">NULL</code></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2974341"></a><h3><a name="g-utf8-find-prev-char"></a>g_utf8_find_prev_char ()</h3><a class="indexterm" name="id2974352"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_utf8_find_prev_char           (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *p);</pre><p>Given a position <em class="parameter"><code>p</code></em> with a UTF-8 encoded string <em class="parameter"><code>str</code></em>, find the startof the previous UTF-8 character starting before <em class="parameter"><code>p</code></em>. Returns <code class="literal">NULL</code> if noUTF-8 characters are present in <em class="parameter"><code>p</code></em> before <em class="parameter"><code>str</code></em>.</p><p><em class="parameter"><code>p</code></em> does not have to be at the beginning of a UTF-8 character. No checkis made to see if the character found is actually valid other thanit starts with an appropriate byte.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td><td> pointer to the beginning of a UTF-8 encoded string</td></tr><tr><td><span class="term"><em class="parameter"><code>p</code></em>&#160;:</span></td><td> pointer to some position within <em class="parameter"><code>str</code></em></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> a pointer to the found character or <code class="literal">NULL</code>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2974494"></a><h3><a name="g-utf8-strlen"></a>g_utf8_strlen ()</h3><a class="indexterm" name="id2974505"></a><pre class="programlisting"><a href="glib-Basic-Types.html#glong">glong</a>       g_utf8_strlen                   (const <a href="glib-Basic-Types.html#gchar">gchar</a> *p,                                             <a href="glib-Basic-Types.html#gssize">gssize</a> max);</pre><p>Returns the length of the string in characters.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>p</code></em>&#160;:</span></td><td> pointer to the start of a UTF-8 encoded string.</td></tr><tr><td><span class="term"><em class="parameter"><code>max</code></em>&#160;:</span></td><td> the maximum number of bytes to examine. If <em class="parameter"><code>max</code></em>      is less than 0, then the string is assumed to be      nul-terminated. If <em class="parameter"><code>max</code></em> is 0, <em class="parameter"><code>p</code></em> will not be examined and       may be <code class="literal">NULL</code>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> the length of the string in characters</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2974614"></a><h3><a name="g-utf8-strncpy"></a>g_utf8_strncpy ()</h3><a class="indexterm" name="id2974624"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_utf8_strncpy                  (<a href="glib-Basic-Types.html#gchar">gchar</a> *dest,                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *src,                                             <a href="glib-Basic-Types.html#gsize">gsize</a> n);</pre><p>Like the standard C <code class="function">strncpy()</code> function, but copies a given number of characters instead of a given number of bytes. The <em class="parameter"><code>src</code></em> string must be valid UTF-8 encoded text. (Use <a href="glib-Unicode-Manipulation.html#g-utf8-validate"><code class="function">g_utf8_validate()</code></a> on all text before trying to use UTF-8 utility functions with it.)</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>dest</code></em>&#160;:</span></td><td> buffer to fill with characters from <em class="parameter"><code>src</code></em></td></tr><tr><td><span class="term"><em class="parameter"><code>src</code></em>&#160;:</span></td><td> UTF-8 encoded string</td></tr><tr><td><span class="term"><em class="parameter"><code>n</code></em>&#160;:</span></td><td> character count</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td> <em class="parameter"><code>dest</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2974769"></a><h3><a name="g-utf8-strchr"></a>g_utf8_strchr ()</h3><a class="indexterm" name="id2974779"></a><pre class="program

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -