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

📄 string_utils.sgml

📁 GLib是GTK+和GNOME工程的基础底层核心程序库
💻 SGML
📖 第 1 页 / 共 5 页
字号:
<entry>any character</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if <parameter>c</parameter> is an ASCII lower case letter</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-ascii-isprint">g_ascii_isprint ()</title><programlisting><link linkend="gboolean">gboolean</link>    g_ascii_isprint                 (<link linkend="gchar">gchar</link> c);</programlisting><para>Determines whether a character is a printing character.</para><para>Unlike the standard C library <function><link linkend="isprint">isprint</link>()</function> function, this only recognizes standard ASCII characters and ignores the locale, returning <literal>FALSE</literal> for all non-ASCII characters. Also unlike the standardlibrary function, this takes a <type>char</type>, not an <type>int</type>, so don't call it on <literal>EOF</literal> but no need to cast to <link linkend="guchar">guchar</link> before passing a possibly non-ASCII character in.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>c</parameter>&nbsp;:</entry><entry>any character</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if <parameter>c</parameter> is an ASCII printing character.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-ascii-ispunct">g_ascii_ispunct ()</title><programlisting><link linkend="gboolean">gboolean</link>    g_ascii_ispunct                 (<link linkend="gchar">gchar</link> c);</programlisting><para>Determines whether a character is a punctuation character.</para><para>Unlike the standard C library <function><link linkend="ispunct">ispunct</link>()</function> function, this only recognizes standard ASCII letters and ignores the locale, returning <literal>FALSE</literal> for all non-ASCII characters. Also unlike the standardlibrary function, this takes a <type>char</type>, not an <type>int</type>, so don't call it on <literal>EOF</literal> but no need to cast to <link linkend="guchar">guchar</link> before passing a possibly non-ASCII character in.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>c</parameter>&nbsp;:</entry><entry>any character</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if <parameter>c</parameter> is an ASCII punctuation character.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-ascii-isspace">g_ascii_isspace ()</title><programlisting><link linkend="gboolean">gboolean</link>    g_ascii_isspace                 (<link linkend="gchar">gchar</link> c);</programlisting><para>Determines whether a character is a white-space character.</para><para>Unlike the standard C library <function><link linkend="isspace">isspace</link>()</function> function, this only recognizes standard ASCII white-space and ignores the locale, returning <literal>FALSE</literal> for all non-ASCII characters. Also unlike the standardlibrary function, this takes a <type>char</type>, not an <type>int</type>, so don't call it on <literal>EOF</literal> but no need to cast to <link linkend="guchar">guchar</link> before passing a possibly non-ASCII character in.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>c</parameter>&nbsp;:</entry><entry>any character</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if <parameter>c</parameter> is an ASCII white-space character</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-ascii-isupper">g_ascii_isupper ()</title><programlisting><link linkend="gboolean">gboolean</link>    g_ascii_isupper                 (<link linkend="gchar">gchar</link> c);</programlisting><para>Determines whether a character is an ASCII upper case letter.</para><para>Unlike the standard C library <function><link linkend="isupper">isupper</link>()</function> function, this only recognizes standard ASCII letters and ignores the locale, returning <literal>FALSE</literal> for all non-ASCII characters. Also unlike the standardlibrary function, this takes a <type>char</type>, not an <type>int</type>, so don't call it on <literal>EOF</literal> but no need to worry about casting to <link linkend="guchar">guchar</link> before passing a possibly non-ASCII character in.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>c</parameter>&nbsp;:</entry><entry>any character</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if <parameter>c</parameter> is an ASCII upper case letter</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-ascii-isxdigit">g_ascii_isxdigit ()</title><programlisting><link linkend="gboolean">gboolean</link>    g_ascii_isxdigit                (<link linkend="gchar">gchar</link> c);</programlisting><para>Determines whether a character is a hexadecimal-digit character.</para><para>Unlike the standard C library <function><link linkend="isxdigit">isxdigit</link>()</function> function,this takes a <type>char</type>, not an <type>int</type>, sodon't call it on <literal>EOF</literal> but no need to cast to <link linkend="guchar">guchar</link> before passing apossibly non-ASCII character in.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>c</parameter>&nbsp;:</entry><entry>any character</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if <parameter>c</parameter> is an ASCII hexadecimal-digit character.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-ascii-digit-value">g_ascii_digit_value ()</title><programlisting><link linkend="gint">gint</link>        g_ascii_digit_value             (<link linkend="gchar">gchar</link> c);</programlisting><para>Determines the numeric value of a character as a decimaldigit. Differs from <link linkend="g-unichar-digit-value">g_unichar_digit_value</link>() because it takesa char, so there's no worry about sign extension if charactersare signed.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>c</parameter>&nbsp;:</entry><entry> an ASCII character.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> If <parameter>c</parameter> is a decimal digit (according to<link linkend="g-ascii-isdigit">g_ascii_isdigit</link>()), its numeric value. Otherwise, -1.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-ascii-xdigit-value">g_ascii_xdigit_value ()</title><programlisting><link linkend="gint">gint</link>        g_ascii_xdigit_value            (<link linkend="gchar">gchar</link> c);</programlisting><para>Determines the numeric value of a character as a hexidecimaldigit. Differs from <link linkend="g-unichar-xdigit-value">g_unichar_xdigit_value</link>() because it takesa char, so there's no worry about sign extension if charactersare signed.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>c</parameter>&nbsp;:</entry><entry> an ASCII character.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> If <parameter>c</parameter> is a hex digit (according to<link linkend="g-ascii-isxdigit">g_ascii_isxdigit</link>()), its numeric value. Otherwise, -1.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-ascii-strcasecmp">g_ascii_strcasecmp ()</title><programlisting><link linkend="gint">gint</link>        g_ascii_strcasecmp              (const <link linkend="gchar">gchar</link> *s1,                                             const <link linkend="gchar">gchar</link> *s2);</programlisting><para>Compare two strings, ignoring the case of ASCII characters.</para><para>Unlike the BSD <link linkend="strcasecmp">strcasecmp</link>() function, this only recognizes standardASCII letters and ignores the locale, treating all non-ASCIIcharacters as if they are not letters.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>s1</parameter>&nbsp;:</entry><entry> string to compare with <parameter>s2</parameter>.</entry></row><row><entry align="right"><parameter>s2</parameter>&nbsp;:</entry><entry> string to compare with <parameter>s1</parameter>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> an integer less than, equal to, or greater than              zero if <parameter>s1</parameter> is found, respectively, to be less than,              to match, or to be greater than <parameter>s2</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-ascii-strncasecmp">g_ascii_strncasecmp ()</title><programlisting><link linkend="gint">gint</link>        g_ascii_strncasecmp             (const <link linkend="gchar">gchar</link> *s1,                                             const <link linkend="gchar">gchar</link> *s2,                                             <link linkend="gsize">gsize</link> n);</programlisting><para>Compare <parameter>s1</parameter> and <parameter>s2</parameter>, ignoring the case of ASCII characters and anycharacters after the first <parameter>n</parameter> in each string.</para><para>Unlike the BSD <link linkend="strcasecmp">strcasecmp</link>() function, this only recognizes standardASCII letters and ignores the locale, treating all non-ASCIIcharacters as if they are not letters.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>s1</parameter>&nbsp;:</entry><entry> string to compare with <parameter>s2</parameter>.</entry></row><row><entry align="right"><parameter>s2</parameter>&nbsp;:</entry><entry> string to compare with <parameter>s1</parameter>.</entry></row><row><entry align="right"><parameter>n</parameter>&nbsp;:</entry><entry>  number of characters to compare.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> an integer less than, equal to, or greater than zero              if the first <parameter>n</parameter> bytes of <parameter>s1</parameter> is found, respectively,              to be less than, to match, or to be greater than the              first <parameter>n</parameter> bytes of <parameter>s2</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-ascii-strup">g_ascii_strup ()</title><programlisting><link linkend="gchar">gchar</link>*      g_ascii_strup                   (const <link linkend="gchar">gchar</link> *str,                                             <link linkend="gssize">gssize</link> len);</programlisting><para>Converts all lower case ASCII letters to upper case ASCII letters.</para>

⌨️ 快捷键说明

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