| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>String Utility Functions</title> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> |
| <link rel="home" href="index.html" title="GLib Reference Manual"> |
| <link rel="up" href="glib-utilities.html" title="GLib Utilities"> |
| <link rel="prev" href="glib-utilities.html" title="GLib Utilities"> |
| <link rel="next" href="glib-Character-Set-Conversion.html" title="Character Set Conversion"> |
| <meta name="generator" content="GTK-Doc V1.14 (XML mode)"> |
| <link rel="stylesheet" href="style.css" type="text/css"> |
| </head> |
| <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> |
| <tr valign="middle"> |
| <td><a accesskey="p" href="glib-utilities.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> |
| <td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> |
| <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> |
| <th width="100%" align="center">GLib Reference Manual</th> |
| <td><a accesskey="n" href="glib-Character-Set-Conversion.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> |
| </tr> |
| <tr><td colspan="5" class="shortcuts"> |
| <a href="#glib-String-Utility-Functions.synopsis" class="shortcut">Top</a> |
| | |
| <a href="#glib-String-Utility-Functions.description" class="shortcut">Description</a> |
| </td></tr> |
| </table> |
| <div class="refentry" title="String Utility Functions"> |
| <a name="glib-String-Utility-Functions"></a><div class="titlepage"></div> |
| <div class="refnamediv"><table width="100%"><tr> |
| <td valign="top"> |
| <h2><span class="refentrytitle"><a name="glib-String-Utility-Functions.top_of_page"></a>String Utility Functions</span></h2> |
| <p>String Utility Functions — various string-related functions</p> |
| </td> |
| <td valign="top" align="right"></td> |
| </tr></table></div> |
| <div class="refsynopsisdiv" title="Synopsis"> |
| <a name="glib-String-Utility-Functions.synopsis"></a><h2>Synopsis</h2> |
| <pre class="synopsis"> |
| #include <glib.h> |
| #include <glib/gprintf.h> |
| |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strdup" title="g_strdup ()">g_strdup</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strndup" title="g_strndup ()">g_strndup</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>** <a class="link" href="glib-String-Utility-Functions.html#g-strdupv" title="g_strdupv ()">g_strdupv</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **str_array</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strnfill" title="g_strnfill ()">g_strnfill</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> length</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> fill_char</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-stpcpy" title="g_stpcpy ()">g_stpcpy</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dest</code></em>, |
| <em class="parameter"><code>const <span class="type">char</span> *src</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-String-Utility-Functions.html#g-strstr-len" title="g_strstr_len ()">g_strstr_len</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *haystack</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> haystack_len</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *needle</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-String-Utility-Functions.html#g-strrstr" title="g_strrstr ()">g_strrstr</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *haystack</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *needle</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-String-Utility-Functions.html#g-strrstr-len" title="g_strrstr_len ()">g_strrstr_len</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *haystack</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> haystack_len</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *needle</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-str-has-prefix" title="g_str_has_prefix ()">g_str_has_prefix</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prefix</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-str-has-suffix" title="g_str_has_suffix ()">g_str_has_suffix</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *suffix</code></em>); |
| <span class="returnvalue">int</span> <a class="link" href="glib-String-Utility-Functions.html#g-strcmp0" title="g_strcmp0 ()">g_strcmp0</a> (<em class="parameter"><code>const <span class="type">char</span> *str1</code></em>, |
| <em class="parameter"><code>const <span class="type">char</span> *str2</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-strlcpy" title="g_strlcpy ()">g_strlcpy</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dest</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *src</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> dest_size</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-strlcat" title="g_strlcat ()">g_strlcat</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dest</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *src</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> dest_size</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strdup-printf" title="g_strdup_printf ()">g_strdup_printf</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>, |
| <em class="parameter"><code>...</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strdup-vprintf" title="g_strdup_vprintf ()">g_strdup_vprintf</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-printf" title="g_printf ()">g_printf</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code>...</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-vprintf" title="g_vprintf ()">g_vprintf</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-fprintf" title="g_fprintf ()">g_fprintf</a> (<em class="parameter"><code><span class="type">FILE</span> *file</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code>...</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-vfprintf" title="g_vfprintf ()">g_vfprintf</a> (<em class="parameter"><code><span class="type">FILE</span> *file</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-sprintf" title="g_sprintf ()">g_sprintf</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code>...</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-vsprintf" title="g_vsprintf ()">g_vsprintf</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-snprintf" title="g_snprintf ()">g_snprintf</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> n</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code>...</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-vsnprintf" title="g_vsnprintf ()">g_vsnprintf</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> n</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-vasprintf" title="g_vasprintf ()">g_vasprintf</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **string</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-printf-string-upper-bound" title="g_printf_string_upper_bound ()">g_printf_string_upper_bound</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-isalnum" title="g_ascii_isalnum ()">g_ascii_isalnum</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-isalpha" title="g_ascii_isalpha ()">g_ascii_isalpha</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-iscntrl" title="g_ascii_iscntrl ()">g_ascii_iscntrl</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-isdigit" title="g_ascii_isdigit ()">g_ascii_isdigit</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-isgraph" title="g_ascii_isgraph ()">g_ascii_isgraph</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-islower" title="g_ascii_islower ()">g_ascii_islower</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-isprint" title="g_ascii_isprint ()">g_ascii_isprint</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-ispunct" title="g_ascii_ispunct ()">g_ascii_ispunct</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-isspace" title="g_ascii_isspace ()">g_ascii_isspace</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-isupper" title="g_ascii_isupper ()">g_ascii_isupper</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-isxdigit" title="g_ascii_isxdigit ()">g_ascii_isxdigit</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-digit-value" title="g_ascii_digit_value ()">g_ascii_digit_value</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-xdigit-value" title="g_ascii_xdigit_value ()">g_ascii_xdigit_value</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strcasecmp" title="g_ascii_strcasecmp ()">g_ascii_strcasecmp</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s1</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s2</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strncasecmp" title="g_ascii_strncasecmp ()">g_ascii_strncasecmp</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s1</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s2</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strup" title="g_ascii_strup ()">g_ascii_strup</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strdown" title="g_ascii_strdown ()">g_ascii_strdown</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-tolower" title="g_ascii_tolower ()">g_ascii_tolower</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-toupper" title="g_ascii_toupper ()">g_ascii_toupper</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>); |
| |
| <a class="link" href="glib-Strings.html#GString" title="GString"><span class="returnvalue">GString</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-string-ascii-up" title="g_string_ascii_up ()">g_string_ascii_up</a> (<em class="parameter"><code><a class="link" href="glib-Strings.html#GString" title="GString"><span class="type">GString</span></a> *string</code></em>); |
| <a class="link" href="glib-Strings.html#GString" title="GString"><span class="returnvalue">GString</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-string-ascii-down" title="g_string_ascii_down ()">g_string_ascii_down</a> (<em class="parameter"><code><a class="link" href="glib-Strings.html#GString" title="GString"><span class="type">GString</span></a> *string</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strup" title="g_strup ()">g_strup</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strdown" title="g_strdown ()">g_strdown</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-strcasecmp" title="g_strcasecmp ()">g_strcasecmp</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s1</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s2</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-strncasecmp" title="g_strncasecmp ()">g_strncasecmp</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s1</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s2</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strreverse" title="g_strreverse ()">g_strreverse</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="returnvalue">gint64</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strtoll" title="g_ascii_strtoll ()">g_ascii_strtoll</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *nptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> base</code></em>); |
| <a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="returnvalue">guint64</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strtoull" title="g_ascii_strtoull ()">g_ascii_strtoull</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *nptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> base</code></em>); |
| #define <a class="link" href="glib-String-Utility-Functions.html#G-ASCII-DTOSTR-BUF-SIZE:CAPS" title="G_ASCII_DTOSTR_BUF_SIZE">G_ASCII_DTOSTR_BUF_SIZE</a> |
| <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="returnvalue">gdouble</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strtod" title="g_ascii_strtod ()">g_ascii_strtod</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *nptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-String-Utility-Functions.html#g-ascii-dtostr" title="g_ascii_dtostr ()">g_ascii_dtostr</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *buffer</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> buf_len</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> d</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-String-Utility-Functions.html#g-ascii-formatd" title="g_ascii_formatd ()">g_ascii_formatd</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *buffer</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> buf_len</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> d</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="returnvalue">gdouble</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-strtod" title="g_strtod ()">g_strtod</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *nptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strchug" title="g_strchug ()">g_strchug</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strchomp" title="g_strchomp ()">g_strchomp</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>); |
| #define <a class="link" href="glib-String-Utility-Functions.html#g-strstrip" title="g_strstrip()">g_strstrip</a> (string) |
| |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strdelimit" title="g_strdelimit ()">g_strdelimit</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *delimiters</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> new_delimiter</code></em>); |
| #define <a class="link" href="glib-String-Utility-Functions.html#G-STR-DELIMITERS:CAPS" title="G_STR_DELIMITERS">G_STR_DELIMITERS</a> |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strescape" title="g_strescape ()">g_strescape</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *source</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *exceptions</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strcompress" title="g_strcompress ()">g_strcompress</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *source</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strcanon" title="g_strcanon ()">g_strcanon</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *valid_chars</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> substitutor</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>** <a class="link" href="glib-String-Utility-Functions.html#g-strsplit" title="g_strsplit ()">g_strsplit</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *delimiter</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> max_tokens</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> ** <a class="link" href="glib-String-Utility-Functions.html#g-strsplit-set" title="g_strsplit_set ()">g_strsplit_set</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *delimiters</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> max_tokens</code></em>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()">g_strfreev</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **str_array</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strconcat" title="g_strconcat ()">g_strconcat</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string1</code></em>, |
| <em class="parameter"><code>...</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strjoin" title="g_strjoin ()">g_strjoin</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *separator</code></em>, |
| <em class="parameter"><code>...</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strjoinv" title="g_strjoinv ()">g_strjoinv</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *separator</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **str_array</code></em>); |
| <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a> <a class="link" href="glib-String-Utility-Functions.html#g-strv-length" title="g_strv_length ()">g_strv_length</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **str_array</code></em>); |
| |
| const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strerror" title="g_strerror ()">g_strerror</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> errnum</code></em>); |
| const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-String-Utility-Functions.html#g-strsignal" title="g_strsignal ()">g_strsignal</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> signum</code></em>); |
| </pre> |
| </div> |
| <div class="refsect1" title="Description"> |
| <a name="glib-String-Utility-Functions.description"></a><h2>Description</h2> |
| <p> |
| This section describes a number of utility functions for creating, |
| duplicating, and manipulating strings. |
| </p> |
| <p> |
| Note that the functions <a class="link" href="glib-String-Utility-Functions.html#g-printf" title="g_printf ()"><code class="function">g_printf()</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-fprintf" title="g_fprintf ()"><code class="function">g_fprintf()</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-sprintf" title="g_sprintf ()"><code class="function">g_sprintf()</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-snprintf" title="g_snprintf ()"><code class="function">g_snprintf()</code></a>, |
| <a class="link" href="glib-String-Utility-Functions.html#g-vprintf" title="g_vprintf ()"><code class="function">g_vprintf()</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-vfprintf" title="g_vfprintf ()"><code class="function">g_vfprintf()</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-vsprintf" title="g_vsprintf ()"><code class="function">g_vsprintf()</code></a> and <a class="link" href="glib-String-Utility-Functions.html#g-vsnprintf" title="g_vsnprintf ()"><code class="function">g_vsnprintf()</code></a> are declared in |
| the header <code class="filename">gprintf.h</code> which is <span class="emphasis"><em>not</em></span> |
| included in <code class="filename">glib.h</code> (otherwise using |
| <code class="filename">glib.h</code> would drag in <code class="filename">stdio.h</code>), so |
| you'll have to explicitly include <code class="literal"><glib/gprintf.h></code> |
| in order to use the GLib <code class="function">printf()</code> functions. |
| </p> |
| <p><a name="string-precision"></a> |
| While you may use the <code class="function">printf()</code> functions to format UTF-8 strings, notice that |
| the precision of a <code class="literal">%Ns</code> parameter is interpreted as the |
| number of <span class="emphasis"><em>bytes</em></span>, not <span class="emphasis"><em>characters</em></span> to print. |
| On top of that, the GNU libc implementation of the <code class="function">printf()</code> functions has the "feature" |
| that it checks that the string given for the <code class="literal">%Ns</code> parameter |
| consists of a whole number of characters in the current encoding. So, unless you |
| are sure you are always going to be in an UTF-8 locale or your know your text is restricted |
| to ASCII, avoid using <code class="literal">%Ns</code>. |
| If your intention is to format strings for a certain number of columns, then |
| <code class="literal">%Ns</code> is not a correct solution anyway, since it fails to take |
| wide characters (see <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iswide" title="g_unichar_iswide ()"><code class="function">g_unichar_iswide()</code></a>) into account. |
| </p> |
| </div> |
| <div class="refsect1" title="Details"> |
| <a name="glib-String-Utility-Functions.details"></a><h2>Details</h2> |
| <div class="refsect2" title="g_strdup ()"> |
| <a name="g-strdup"></a><h3>g_strdup ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strdup (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>);</pre> |
| <p> |
| Duplicates a string. If <em class="parameter"><code>str</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> it returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. |
| The returned string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> |
| when no longer needed. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str</code></em> :</span></p></td> |
| <td>the string to duplicate |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated copy of <em class="parameter"><code>str</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strndup ()"> |
| <a name="g-strndup"></a><h3>g_strndup ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strndup (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n</code></em>);</pre> |
| <p> |
| Duplicates the first <em class="parameter"><code>n</code></em> bytes of a string, returning a newly-allocated |
| buffer <em class="parameter"><code>n</code></em> + 1 bytes long which will always be nul-terminated. |
| If <em class="parameter"><code>str</code></em> is less than <em class="parameter"><code>n</code></em> bytes long the buffer is padded with nuls. |
| If <em class="parameter"><code>str</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> it returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. |
| The returned value should be freed when no longer needed. |
| </p> |
| <p> |
| </p> |
| <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| <h3 class="title">Note</h3> |
| <p> |
| To copy a number of characters from a UTF-8 encoded string, use |
| <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strncpy" title="g_utf8_strncpy ()"><code class="function">g_utf8_strncpy()</code></a> instead. |
| </p> |
| </div> |
| <p> |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str</code></em> :</span></p></td> |
| <td>the string to duplicate |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td> |
| <td>the maximum number of bytes to copy from <em class="parameter"><code>str</code></em> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated buffer containing the first <em class="parameter"><code>n</code></em> bytes |
| of <em class="parameter"><code>str</code></em>, nul-terminated |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strdupv ()"> |
| <a name="g-strdupv"></a><h3>g_strdupv ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>** g_strdupv (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **str_array</code></em>);</pre> |
| <p> |
| Copies <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings. The copy is a deep copy; |
| the new array should be freed by first freeing each string, then |
| the array itself. <a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a> does this for you. If called |
| on a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> value, <a class="link" href="glib-String-Utility-Functions.html#g-strdupv" title="g_strdupv ()"><code class="function">g_strdupv()</code></a> simply returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str_array</code></em> :</span></p></td> |
| <td> |
| <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a new <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strnfill ()"> |
| <a name="g-strnfill"></a><h3>g_strnfill ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strnfill (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> length</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> fill_char</code></em>);</pre> |
| <p> |
| Creates a new string <em class="parameter"><code>length</code></em> bytes long filled with <em class="parameter"><code>fill_char</code></em>. |
| The returned string should be freed when no longer needed. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td> |
| <td>the length of the new string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>fill_char</code></em> :</span></p></td> |
| <td>the byte to fill the string with |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated string filled the <em class="parameter"><code>fill_char</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_stpcpy ()"> |
| <a name="g-stpcpy"></a><h3>g_stpcpy ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_stpcpy (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dest</code></em>, |
| <em class="parameter"><code>const <span class="type">char</span> *src</code></em>);</pre> |
| <p> |
| Copies a nul-terminated string into the dest buffer, include the |
| trailing nul, and return a pointer to the trailing nul byte. |
| This is useful for concatenating multiple strings together |
| without having to repeatedly scan for the end. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td> |
| <td>destination buffer. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td> |
| <td>source string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a pointer to trailing nul byte. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strstr_len ()"> |
| <a name="g-strstr-len"></a><h3>g_strstr_len ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_strstr_len (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *haystack</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> haystack_len</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *needle</code></em>);</pre> |
| <p> |
| Searches the string <em class="parameter"><code>haystack</code></em> for the first occurrence |
| of the string <em class="parameter"><code>needle</code></em>, limiting the length of the search |
| to <em class="parameter"><code>haystack_len</code></em>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>haystack</code></em> :</span></p></td> |
| <td>a string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>haystack_len</code></em> :</span></p></td> |
| <td>the maximum length of <em class="parameter"><code>haystack</code></em>. Note that -1 is |
| a valid length, if <em class="parameter"><code>haystack</code></em> is nul-terminated, meaning it will |
| search through the whole string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>needle</code></em> :</span></p></td> |
| <td>the string to search for. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a pointer to the found occurrence, or |
| <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if not found. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strrstr ()"> |
| <a name="g-strrstr"></a><h3>g_strrstr ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_strrstr (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *haystack</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *needle</code></em>);</pre> |
| <p> |
| Searches the string <em class="parameter"><code>haystack</code></em> for the last occurrence |
| of the string <em class="parameter"><code>needle</code></em>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>haystack</code></em> :</span></p></td> |
| <td>a nul-terminated string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>needle</code></em> :</span></p></td> |
| <td>the nul-terminated string to search for. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a pointer to the found occurrence, or |
| <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if not found. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strrstr_len ()"> |
| <a name="g-strrstr-len"></a><h3>g_strrstr_len ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_strrstr_len (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *haystack</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> haystack_len</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *needle</code></em>);</pre> |
| <p> |
| Searches the string <em class="parameter"><code>haystack</code></em> for the last occurrence |
| of the string <em class="parameter"><code>needle</code></em>, limiting the length of the search |
| to <em class="parameter"><code>haystack_len</code></em>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>haystack</code></em> :</span></p></td> |
| <td>a nul-terminated string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>haystack_len</code></em> :</span></p></td> |
| <td>the maximum length of <em class="parameter"><code>haystack</code></em>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>needle</code></em> :</span></p></td> |
| <td>the nul-terminated string to search for. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a pointer to the found occurrence, or |
| <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if not found. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_str_has_prefix ()"> |
| <a name="g-str-has-prefix"></a><h3>g_str_has_prefix ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_str_has_prefix (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prefix</code></em>);</pre> |
| <p> |
| Looks whether the string <em class="parameter"><code>str</code></em> begins with <em class="parameter"><code>prefix</code></em>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str</code></em> :</span></p></td> |
| <td>a nul-terminated string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>prefix</code></em> :</span></p></td> |
| <td>the nul-terminated prefix to look for. |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>str</code></em> begins with <em class="parameter"><code>prefix</code></em>, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.2</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_str_has_suffix ()"> |
| <a name="g-str-has-suffix"></a><h3>g_str_has_suffix ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_str_has_suffix (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *suffix</code></em>);</pre> |
| <p> |
| Looks whether the string <em class="parameter"><code>str</code></em> ends with <em class="parameter"><code>suffix</code></em>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str</code></em> :</span></p></td> |
| <td>a nul-terminated string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>suffix</code></em> :</span></p></td> |
| <td>the nul-terminated suffix to look for. |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>str</code></em> end with <em class="parameter"><code>suffix</code></em>, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.2</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strcmp0 ()"> |
| <a name="g-strcmp0"></a><h3>g_strcmp0 ()</h3> |
| <pre class="programlisting"><span class="returnvalue">int</span> g_strcmp0 (<em class="parameter"><code>const <span class="type">char</span> *str1</code></em>, |
| <em class="parameter"><code>const <span class="type">char</span> *str2</code></em>);</pre> |
| <p> |
| Compares <em class="parameter"><code>str1</code></em> and <em class="parameter"><code>str2</code></em> like <code class="function">strcmp()</code>. Handles <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> |
| gracefully by sorting it before non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> strings. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str1</code></em> :</span></p></td> |
| <td>a C string or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str2</code></em> :</span></p></td> |
| <td>another C string or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><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> -1, 0 or 1, if <em class="parameter"><code>str1</code></em> is <, == or > than <em class="parameter"><code>str2</code></em>. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.16</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strlcpy ()"> |
| <a name="g-strlcpy"></a><h3>g_strlcpy ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> g_strlcpy (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dest</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *src</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> dest_size</code></em>);</pre> |
| <p> |
| Portability wrapper that calls <code class="function">strlcpy()</code> on systems which have it, |
| and emulates <code class="function">strlcpy()</code> otherwise. Copies <em class="parameter"><code>src</code></em> to <em class="parameter"><code>dest</code></em>; <em class="parameter"><code>dest</code></em> is |
| guaranteed to be nul-terminated; <em class="parameter"><code>src</code></em> must be nul-terminated; |
| <em class="parameter"><code>dest_size</code></em> is the buffer size, not the number of chars to copy. |
| </p> |
| <p> |
| At most dest_size - 1 characters will be copied. Always nul-terminates |
| (unless dest_size == 0). This function does <span class="emphasis"><em>not</em></span> |
| allocate memory. Unlike <code class="function">strncpy()</code>, this function doesn't pad dest (so |
| it's often faster). It returns the size of the attempted result, |
| strlen (src), so if <em class="parameter"><code>retval</code></em> >= <em class="parameter"><code>dest_size</code></em>, truncation occurred. |
| </p> |
| <p> |
| </p> |
| <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| <h3 class="title">Note</h3> |
| <p>Caveat: <code class="function">strlcpy()</code> is supposedly more secure than |
| <code class="function">strcpy()</code> or <code class="function">strncpy()</code>, but if you really want to avoid screwups, |
| <a class="link" href="glib-String-Utility-Functions.html#g-strdup" title="g_strdup ()"><code class="function">g_strdup()</code></a> is an even better idea.</p> |
| </div> |
| <p> |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td> |
| <td>destination buffer |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td> |
| <td>source buffer |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>dest_size</code></em> :</span></p></td> |
| <td>length of <em class="parameter"><code>dest</code></em> in bytes |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> length of <em class="parameter"><code>src</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strlcat ()"> |
| <a name="g-strlcat"></a><h3>g_strlcat ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> g_strlcat (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dest</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *src</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> dest_size</code></em>);</pre> |
| <p> |
| Portability wrapper that calls <code class="function">strlcat()</code> on systems which have it, |
| and emulates it otherwise. Appends nul-terminated <em class="parameter"><code>src</code></em> string to <em class="parameter"><code>dest</code></em>, |
| guaranteeing nul-termination for <em class="parameter"><code>dest</code></em>. The total size of <em class="parameter"><code>dest</code></em> won't |
| exceed <em class="parameter"><code>dest_size</code></em>. |
| </p> |
| <p> |
| At most dest_size - 1 characters will be copied. |
| Unlike strncat, dest_size is the full size of dest, not the space left over. |
| This function does NOT allocate memory. |
| This always NUL terminates (unless siz == 0 or there were no NUL characters |
| in the dest_size characters of dest to start with). |
| </p> |
| <p> |
| </p> |
| <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| <h3 class="title">Note</h3> |
| <p>Caveat: this is supposedly a more secure alternative to |
| <code class="function">strcat()</code> or <code class="function">strncat()</code>, but for real security <a class="link" href="glib-String-Utility-Functions.html#g-strconcat" title="g_strconcat ()"><code class="function">g_strconcat()</code></a> is harder |
| to mess up.</p> |
| </div> |
| <p> |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td> |
| <td>destination buffer, already containing one nul-terminated string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td> |
| <td>source buffer |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>dest_size</code></em> :</span></p></td> |
| <td>length of <em class="parameter"><code>dest</code></em> buffer in bytes (not length of existing string |
| inside <em class="parameter"><code>dest</code></em>) |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>size of attempted result, which is |
| MIN (dest_size, strlen (original dest)) + strlen (src), |
| so if retval >= dest_size, truncation occurred. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strdup_printf ()"> |
| <a name="g-strdup-printf"></a><h3>g_strdup_printf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strdup_printf (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p> |
| Similar to the standard C <code class="function">sprintf()</code> function but safer, since it |
| calculates the maximum space required and allocates memory to hold |
| the result. The returned string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when no |
| longer needed. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>the parameters to insert into the format string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated string holding the result |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strdup_vprintf ()"> |
| <a name="g-strdup-vprintf"></a><h3>g_strdup_vprintf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strdup_vprintf (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre> |
| <p> |
| Similar to the standard C <code class="function">vsprintf()</code> function but safer, since it |
| calculates the maximum space required and allocates memory to hold |
| the result. The returned string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when |
| no longer needed. |
| </p> |
| <p> |
| See also <a class="link" href="glib-String-Utility-Functions.html#g-vasprintf" title="g_vasprintf ()"><code class="function">g_vasprintf()</code></a>, which offers the same functionality, but |
| additionally returns the length of the allocated string. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td> |
| <td>the list of parameters to insert into the format string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated string holding the result |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_printf ()"> |
| <a name="g-printf"></a><h3>g_printf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_printf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p> |
| An implementation of the standard <code class="function">printf()</code> function which supports |
| positional parameters, as specified in the Single Unix Specification. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>the arguments to insert in the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the number of bytes printed. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.2</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_vprintf ()"> |
| <a name="g-vprintf"></a><h3>g_vprintf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_vprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre> |
| <p> |
| An implementation of the standard <code class="function">vprintf()</code> function which supports |
| positional parameters, as specified in the Single Unix Specification. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td> |
| <td>the list of arguments to insert in the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the number of bytes printed. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.2</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_fprintf ()"> |
| <a name="g-fprintf"></a><h3>g_fprintf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_fprintf (<em class="parameter"><code><span class="type">FILE</span> *file</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p> |
| An implementation of the standard <code class="function">fprintf()</code> function which supports |
| positional parameters, as specified in the Single Unix Specification. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td> |
| <td>the stream to write to. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>the arguments to insert in the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the number of bytes printed. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.2</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_vfprintf ()"> |
| <a name="g-vfprintf"></a><h3>g_vfprintf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_vfprintf (<em class="parameter"><code><span class="type">FILE</span> *file</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre> |
| <p> |
| An implementation of the standard <code class="function">fprintf()</code> function which supports |
| positional parameters, as specified in the Single Unix Specification. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td> |
| <td>the stream to write to. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td> |
| <td>the list of arguments to insert in the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the number of bytes printed. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.2</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_sprintf ()"> |
| <a name="g-sprintf"></a><h3>g_sprintf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_sprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p> |
| An implementation of the standard <code class="function">sprintf()</code> function which supports |
| positional parameters, as specified in the Single Unix Specification. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>A pointer to a memory buffer to contain the resulting string. It |
| is up to the caller to ensure that the allocated buffer is large |
| enough to hold the formatted result |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>the arguments to insert in the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the number of bytes printed. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.2</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_vsprintf ()"> |
| <a name="g-vsprintf"></a><h3>g_vsprintf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_vsprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre> |
| <p> |
| An implementation of the standard <code class="function">vsprintf()</code> function which supports |
| positional parameters, as specified in the Single Unix Specification. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>the buffer to hold the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td> |
| <td>the list of arguments to insert in the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the number of bytes printed. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.2</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_snprintf ()"> |
| <a name="g-snprintf"></a><h3>g_snprintf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_snprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> n</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p> |
| A safer form of the standard <code class="function">sprintf()</code> function. The output is guaranteed |
| to not exceed <em class="parameter"><code>n</code></em> characters (including the terminating nul character), so |
| it is easy to ensure that a buffer overflow cannot occur. |
| </p> |
| <p> |
| See also <a class="link" href="glib-String-Utility-Functions.html#g-strdup-printf" title="g_strdup_printf ()"><code class="function">g_strdup_printf()</code></a>. |
| </p> |
| <p> |
| In versions of GLib prior to 1.2.3, this function may return -1 if the |
| output was truncated, and the truncated string may not be nul-terminated. |
| In versions prior to 1.3.12, this function returns the length of the output |
| string. |
| </p> |
| <p> |
| The return value of <a class="link" href="glib-String-Utility-Functions.html#g-snprintf" title="g_snprintf ()"><code class="function">g_snprintf()</code></a> conforms to the <code class="function">snprintf()</code> |
| function as standardized in ISO C99. Note that this is different from |
| traditional <code class="function">snprintf()</code>, which returns the length of the output string. |
| </p> |
| <p> |
| The format string may contain positional parameters, as specified in |
| the Single Unix Specification. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>the buffer to hold the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td> |
| <td>the maximum number of bytes to produce (including the |
| terminating nul character). |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>the arguments to insert in the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the number of bytes which would be produced if the buffer |
| was large enough. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_vsnprintf ()"> |
| <a name="g-vsnprintf"></a><h3>g_vsnprintf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_vsnprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> n</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre> |
| <p> |
| A safer form of the standard <code class="function">vsprintf()</code> function. The output is guaranteed |
| to not exceed <em class="parameter"><code>n</code></em> characters (including the terminating nul character), so |
| it is easy to ensure that a buffer overflow cannot occur. |
| </p> |
| <p> |
| See also <a class="link" href="glib-String-Utility-Functions.html#g-strdup-vprintf" title="g_strdup_vprintf ()"><code class="function">g_strdup_vprintf()</code></a>. |
| </p> |
| <p> |
| In versions of GLib prior to 1.2.3, this function may return -1 if the |
| output was truncated, and the truncated string may not be nul-terminated. |
| In versions prior to 1.3.12, this function returns the length of the output |
| string. |
| </p> |
| <p> |
| The return value of <a class="link" href="glib-String-Utility-Functions.html#g-vsnprintf" title="g_vsnprintf ()"><code class="function">g_vsnprintf()</code></a> conforms to the <code class="function">vsnprintf()</code> function |
| as standardized in ISO C99. Note that this is different from traditional |
| <code class="function">vsnprintf()</code>, which returns the length of the output string. |
| </p> |
| <p> |
| The format string may contain positional parameters, as specified in |
| the Single Unix Specification. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>the buffer to hold the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td> |
| <td>the maximum number of bytes to produce (including the |
| terminating nul character). |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td> |
| <td>the list of arguments to insert in the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the number of bytes which would be produced if the buffer |
| was large enough. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_vasprintf ()"> |
| <a name="g-vasprintf"></a><h3>g_vasprintf ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_vasprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **string</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre> |
| <p> |
| An implementation of the GNU <code class="function">vasprintf()</code> function which supports |
| positional parameters, as specified in the Single Unix Specification. |
| This function is similar to <a class="link" href="glib-String-Utility-Functions.html#g-vsprintf" title="g_vsprintf ()"><code class="function">g_vsprintf()</code></a>, except that it allocates a |
| string to hold the output, instead of putting the output in a buffer |
| you allocate in advance. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>the return location for the newly-allocated string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a standard <code class="function">printf()</code> format string, but notice |
| <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td> |
| <td>the list of arguments to insert in the output. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the number of bytes printed. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.4</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_printf_string_upper_bound ()"> |
| <a name="g-printf-string-upper-bound"></a><h3>g_printf_string_upper_bound ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> g_printf_string_upper_bound (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>, |
| <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre> |
| <p> |
| Calculates the maximum space needed to store the output of the <code class="function">sprintf()</code> |
| function. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>the format string. See the <code class="function">printf()</code> documentation. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td> |
| <td>the parameters to be inserted into the format string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the maximum space needed to store the formatted string. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_isalnum ()"> |
| <a name="g-ascii-isalnum"></a><h3>g_ascii_isalnum ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_isalnum (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is alphanumeric. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">isalnum()</code> function, this only |
| recognizes standard ASCII letters and ignores the locale, returning |
| <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also unlike the standard |
| library function, this takes a <span class="type">char</span>, not an <span class="type">int</span>, |
| so don't call it on <code class="literal">EOF</code> but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a |
| possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII alphanumeric character |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_isalpha ()"> |
| <a name="g-ascii-isalpha"></a><h3>g_ascii_isalpha ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_isalpha (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is alphabetic (i.e. a letter). |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">isalpha()</code> function, this only |
| recognizes standard ASCII letters and ignores the locale, returning |
| <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also unlike the standard |
| library function, this takes a <span class="type">char</span>, not an <span class="type">int</span>, |
| so don't call it on <code class="literal">EOF</code> but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a |
| possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII alphabetic character |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_iscntrl ()"> |
| <a name="g-ascii-iscntrl"></a><h3>g_ascii_iscntrl ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_iscntrl (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is a control character. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">iscntrl()</code> function, this only |
| recognizes standard ASCII control characters and ignores the locale, |
| returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also unlike the standard |
| library function, this takes a <span class="type">char</span>, not an <span class="type">int</span>, |
| so don't call it on <code class="literal">EOF</code> but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a |
| possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII control character. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_isdigit ()"> |
| <a name="g-ascii-isdigit"></a><h3>g_ascii_isdigit ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_isdigit (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is digit (0-9). |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">isdigit()</code> function, |
| this takes a <span class="type">char</span>, not an <span class="type">int</span>, so don't call it |
| on <code class="literal">EOF</code> but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a possibly |
| non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII digit. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_isgraph ()"> |
| <a name="g-ascii-isgraph"></a><h3>g_ascii_isgraph ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_isgraph (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is a printing character and not a space. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">isgraph()</code> function, |
| this only recognizes standard ASCII characters and ignores the locale, |
| returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also unlike the standard |
| library function, this takes a <span class="type">char</span>, not an <span class="type">int</span>, |
| so don't call it on <code class="literal">EOF</code> but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a |
| possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII printing character other than space. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_islower ()"> |
| <a name="g-ascii-islower"></a><h3>g_ascii_islower ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_islower (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is an ASCII lower case letter. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">islower()</code> function, |
| this only recognizes standard ASCII letters and ignores the locale, |
| returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also unlike the standard |
| library function, this takes a <span class="type">char</span>, not an <span class="type">int</span>, |
| so don't call it on <code class="literal">EOF</code> but no need to worry about casting to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> |
| before passing a possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII lower case letter |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_isprint ()"> |
| <a name="g-ascii-isprint"></a><h3>g_ascii_isprint ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_isprint (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is a printing character. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">isprint()</code> function, |
| this only recognizes standard ASCII characters and ignores the locale, |
| returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also unlike the standard |
| library function, this takes a <span class="type">char</span>, not an <span class="type">int</span>, |
| so don't call it on <code class="literal">EOF</code> but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a |
| possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII printing character. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_ispunct ()"> |
| <a name="g-ascii-ispunct"></a><h3>g_ascii_ispunct ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_ispunct (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is a punctuation character. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">ispunct()</code> function, |
| this only recognizes standard ASCII letters and ignores the locale, |
| returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also unlike the standard |
| library function, this takes a <span class="type">char</span>, not an <span class="type">int</span>, |
| so don't call it on <code class="literal">EOF</code> but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a |
| possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII punctuation character. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_isspace ()"> |
| <a name="g-ascii-isspace"></a><h3>g_ascii_isspace ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_isspace (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is a white-space character. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">isspace()</code> function, |
| this only recognizes standard ASCII white-space and ignores the locale, |
| returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also unlike the standard |
| library function, this takes a <span class="type">char</span>, not an <span class="type">int</span>, |
| so don't call it on <code class="literal">EOF</code> but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a |
| possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII white-space character |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_isupper ()"> |
| <a name="g-ascii-isupper"></a><h3>g_ascii_isupper ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_isupper (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is an ASCII upper case letter. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">isupper()</code> function, |
| this only recognizes standard ASCII letters and ignores the locale, |
| returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also unlike the standard |
| library function, this takes a <span class="type">char</span>, not an <span class="type">int</span>, |
| so don't call it on <code class="literal">EOF</code> but no need to worry about casting to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> |
| before passing a possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII upper case letter |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_isxdigit ()"> |
| <a name="g-ascii-isxdigit"></a><h3>g_ascii_isxdigit ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_ascii_isxdigit (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines whether a character is a hexadecimal-digit character. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">isxdigit()</code> function, |
| this takes a <span class="type">char</span>, not an <span class="type">int</span>, so |
| don't call it on <code class="literal">EOF</code> but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a |
| possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character |
| </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" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an ASCII hexadecimal-digit character. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_digit_value ()"> |
| <a name="g-ascii-digit-value"></a><h3>g_ascii_digit_value ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_ascii_digit_value (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines the numeric value of a character as a decimal |
| digit. Differs from <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-digit-value" title="g_unichar_digit_value ()"><code class="function">g_unichar_digit_value()</code></a> because it takes |
| a char, so there's no worry about sign extension if characters |
| are signed. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>an ASCII character. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> If <em class="parameter"><code>c</code></em> is a decimal digit (according to |
| <a class="link" href="glib-String-Utility-Functions.html#g-ascii-isdigit" title="g_ascii_isdigit ()"><code class="function">g_ascii_isdigit()</code></a>), its numeric value. Otherwise, -1. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_xdigit_value ()"> |
| <a name="g-ascii-xdigit-value"></a><h3>g_ascii_xdigit_value ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_ascii_xdigit_value (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Determines the numeric value of a character as a hexidecimal |
| digit. Differs from <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-xdigit-value" title="g_unichar_xdigit_value ()"><code class="function">g_unichar_xdigit_value()</code></a> because it takes |
| a char, so there's no worry about sign extension if characters |
| are signed. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>an ASCII character. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> If <em class="parameter"><code>c</code></em> is a hex digit (according to |
| <a class="link" href="glib-String-Utility-Functions.html#g-ascii-isxdigit" title="g_ascii_isxdigit ()"><code class="function">g_ascii_isxdigit()</code></a>), its numeric value. Otherwise, -1. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_strcasecmp ()"> |
| <a name="g-ascii-strcasecmp"></a><h3>g_ascii_strcasecmp ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_ascii_strcasecmp (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s1</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s2</code></em>);</pre> |
| <p> |
| Compare two strings, ignoring the case of ASCII characters. |
| </p> |
| <p> |
| Unlike the BSD <code class="function">strcasecmp()</code> function, this only recognizes standard |
| ASCII letters and ignores the locale, treating all non-ASCII |
| bytes as if they are not letters. |
| </p> |
| <p> |
| This function should be used only on strings that are known to be |
| in encodings where the bytes corresponding to ASCII letters always |
| represent themselves. This includes UTF-8 and the ISO-8859-* |
| charsets, but not for instance double-byte encodings like the |
| Windows Codepage 932, where the trailing bytes of double-byte |
| characters include all ASCII letters. If you compare two CP932 |
| strings using this function, you will get false matches. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>s1</code></em> :</span></p></td> |
| <td>string to compare with <em class="parameter"><code>s2</code></em>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>s2</code></em> :</span></p></td> |
| <td>string to compare with <em class="parameter"><code>s1</code></em>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> 0 if the strings match, a negative value if <em class="parameter"><code>s1</code></em> < <em class="parameter"><code>s2</code></em>, |
| or a positive value if <em class="parameter"><code>s1</code></em> > <em class="parameter"><code>s2</code></em>. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_strncasecmp ()"> |
| <a name="g-ascii-strncasecmp"></a><h3>g_ascii_strncasecmp ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_ascii_strncasecmp (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s1</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s2</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n</code></em>);</pre> |
| <p> |
| Compare <em class="parameter"><code>s1</code></em> and <em class="parameter"><code>s2</code></em>, ignoring the case of ASCII characters and any |
| characters after the first <em class="parameter"><code>n</code></em> in each string. |
| </p> |
| <p> |
| Unlike the BSD <code class="function">strcasecmp()</code> function, this only recognizes standard |
| ASCII letters and ignores the locale, treating all non-ASCII |
| characters as if they are not letters. |
| </p> |
| <p> |
| The same warning as in <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strcasecmp" title="g_ascii_strcasecmp ()"><code class="function">g_ascii_strcasecmp()</code></a> applies: Use this |
| function only on strings known to be in encodings where bytes |
| corresponding to ASCII letters always represent themselves. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>s1</code></em> :</span></p></td> |
| <td>string to compare with <em class="parameter"><code>s2</code></em>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>s2</code></em> :</span></p></td> |
| <td>string to compare with <em class="parameter"><code>s1</code></em>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td> |
| <td>number of characters to compare. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> 0 if the strings match, a negative value if <em class="parameter"><code>s1</code></em> < <em class="parameter"><code>s2</code></em>, |
| or a positive value if <em class="parameter"><code>s1</code></em> > <em class="parameter"><code>s2</code></em>. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_strup ()"> |
| <a name="g-ascii-strup"></a><h3>g_ascii_strup ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_ascii_strup (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>);</pre> |
| <p> |
| Converts all lower case ASCII letters to upper case ASCII letters. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str</code></em> :</span></p></td> |
| <td>a string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td> |
| <td>length of <em class="parameter"><code>str</code></em> in bytes, or -1 if <em class="parameter"><code>str</code></em> is nul-terminated. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly allocated string, with all the lower case |
| characters in <em class="parameter"><code>str</code></em> converted to upper case, with |
| semantics that exactly match <a class="link" href="glib-String-Utility-Functions.html#g-ascii-toupper" title="g_ascii_toupper ()"><code class="function">g_ascii_toupper()</code></a>. (Note |
| that this is unlike the old <a class="link" href="glib-String-Utility-Functions.html#g-strup" title="g_strup ()"><code class="function">g_strup()</code></a>, which modified |
| the string in place.) |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_strdown ()"> |
| <a name="g-ascii-strdown"></a><h3>g_ascii_strdown ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_ascii_strdown (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>);</pre> |
| <p> |
| Converts all upper case ASCII letters to lower case ASCII letters. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str</code></em> :</span></p></td> |
| <td>a string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td> |
| <td>length of <em class="parameter"><code>str</code></em> in bytes, or -1 if <em class="parameter"><code>str</code></em> is nul-terminated. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated string, with all the upper case |
| characters in <em class="parameter"><code>str</code></em> converted to lower case, with |
| semantics that exactly match <a class="link" href="glib-String-Utility-Functions.html#g-ascii-tolower" title="g_ascii_tolower ()"><code class="function">g_ascii_tolower()</code></a>. (Note |
| that this is unlike the old <a class="link" href="glib-String-Utility-Functions.html#g-strdown" title="g_strdown ()"><code class="function">g_strdown()</code></a>, which modified |
| the string in place.) |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_tolower ()"> |
| <a name="g-ascii-tolower"></a><h3>g_ascii_tolower ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> g_ascii_tolower (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Convert a character to ASCII lower case. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">tolower()</code> function, this only |
| recognizes standard ASCII letters and ignores the locale, returning |
| all non-ASCII characters unchanged, even if they are lower case |
| letters in a particular character set. Also unlike the standard |
| library function, this takes and returns a char, not an int, so |
| don't call it on <code class="literal">EOF</code> but no need to worry about casting to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> |
| before passing a possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the result of converting <em class="parameter"><code>c</code></em> to lower case. |
| If <em class="parameter"><code>c</code></em> is not an ASCII upper case letter, |
| <em class="parameter"><code>c</code></em> is returned unchanged. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_toupper ()"> |
| <a name="g-ascii-toupper"></a><h3>g_ascii_toupper ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> g_ascii_toupper (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre> |
| <p> |
| Convert a character to ASCII upper case. |
| </p> |
| <p> |
| Unlike the standard C library <code class="function">toupper()</code> function, this only |
| recognizes standard ASCII letters and ignores the locale, returning |
| all non-ASCII characters unchanged, even if they are upper case |
| letters in a particular character set. Also unlike the standard |
| library function, this takes and returns a char, not an int, so |
| don't call it on <code class="literal">EOF</code> but no need to worry about casting to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> |
| before passing a possibly non-ASCII character in. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td> |
| <td>any character. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the result of converting <em class="parameter"><code>c</code></em> to upper case. |
| If <em class="parameter"><code>c</code></em> is not an ASCII lower case letter, |
| <em class="parameter"><code>c</code></em> is returned unchanged. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_string_ascii_up ()"> |
| <a name="g-string-ascii-up"></a><h3>g_string_ascii_up ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Strings.html#GString" title="GString"><span class="returnvalue">GString</span></a>* g_string_ascii_up (<em class="parameter"><code><a class="link" href="glib-Strings.html#GString" title="GString"><span class="type">GString</span></a> *string</code></em>);</pre> |
| <p> |
| Converts all lower case ASCII letters to upper case ASCII letters. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a GString |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> passed-in <em class="parameter"><code>string</code></em> pointer, with all the lower case |
| characters converted to upper case in place, with |
| semantics that exactly match <a class="link" href="glib-String-Utility-Functions.html#g-ascii-toupper" title="g_ascii_toupper ()"><code class="function">g_ascii_toupper()</code></a>. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_string_ascii_down ()"> |
| <a name="g-string-ascii-down"></a><h3>g_string_ascii_down ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Strings.html#GString" title="GString"><span class="returnvalue">GString</span></a>* g_string_ascii_down (<em class="parameter"><code><a class="link" href="glib-Strings.html#GString" title="GString"><span class="type">GString</span></a> *string</code></em>);</pre> |
| <p> |
| Converts all upper case ASCII letters to lower case ASCII letters. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a GString |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> passed-in <em class="parameter"><code>string</code></em> pointer, with all the upper case |
| characters converted to lower case in place, with |
| semantics that exactly match <a class="link" href="glib-String-Utility-Functions.html#g-ascii-tolower" title="g_ascii_tolower ()"><code class="function">g_ascii_tolower()</code></a>. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strup ()"> |
| <a name="g-strup"></a><h3>g_strup ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strup (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre> |
| <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| <h3 class="title">Warning</h3> |
| <p><code class="literal">g_strup</code> has been deprecated since version 2.2 and should not be used in newly-written code. This function is totally broken for the reasons discussed |
| in the <a class="link" href="glib-String-Utility-Functions.html#g-strncasecmp" title="g_strncasecmp ()"><code class="function">g_strncasecmp()</code></a> docs - use <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strup" title="g_ascii_strup ()"><code class="function">g_ascii_strup()</code></a> or <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strup" title="g_utf8_strup ()"><code class="function">g_utf8_strup()</code></a> instead.</p> |
| </div> |
| <p> |
| Converts a string to upper case. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>the string to convert. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the string |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strdown ()"> |
| <a name="g-strdown"></a><h3>g_strdown ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strdown (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre> |
| <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| <h3 class="title">Warning</h3> |
| <p><code class="literal">g_strdown</code> has been deprecated since version 2.2 and should not be used in newly-written code. This function is totally broken for the reasons discussed |
| in the <a class="link" href="glib-String-Utility-Functions.html#g-strncasecmp" title="g_strncasecmp ()"><code class="function">g_strncasecmp()</code></a> docs - use <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strdown" title="g_ascii_strdown ()"><code class="function">g_ascii_strdown()</code></a> or <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strdown" title="g_utf8_strdown ()"><code class="function">g_utf8_strdown()</code></a> |
| instead.</p> |
| </div> |
| <p> |
| Converts a string to lower case. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>the string to convert. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the string |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strcasecmp ()"> |
| <a name="g-strcasecmp"></a><h3>g_strcasecmp ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_strcasecmp (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s1</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s2</code></em>);</pre> |
| <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| <h3 class="title">Warning</h3> |
| <p><code class="literal">g_strcasecmp</code> has been deprecated since version 2.2 and should not be used in newly-written code. See <a class="link" href="glib-String-Utility-Functions.html#g-strncasecmp" title="g_strncasecmp ()"><code class="function">g_strncasecmp()</code></a> for a discussion of why this function |
| is deprecated and how to replace it.</p> |
| </div> |
| <p> |
| A case-insensitive string comparison, corresponding to the standard |
| <code class="function">strcasecmp()</code> function on platforms which support it. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>s1</code></em> :</span></p></td> |
| <td>a string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>s2</code></em> :</span></p></td> |
| <td>a string to compare with <em class="parameter"><code>s1</code></em>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> 0 if the strings match, a negative value if <em class="parameter"><code>s1</code></em> < <em class="parameter"><code>s2</code></em>, |
| or a positive value if <em class="parameter"><code>s1</code></em> > <em class="parameter"><code>s2</code></em>. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strncasecmp ()"> |
| <a name="g-strncasecmp"></a><h3>g_strncasecmp ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_strncasecmp (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s1</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s2</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n</code></em>);</pre> |
| <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| <h3 class="title">Warning</h3> |
| <p><code class="literal">g_strncasecmp</code> has been deprecated since version 2.2 and should not be used in newly-written code. The problem with <a class="link" href="glib-String-Utility-Functions.html#g-strncasecmp" title="g_strncasecmp ()"><code class="function">g_strncasecmp()</code></a> is that it does the |
| comparison by calling <code class="function">toupper()</code>/<code class="function">tolower()</code>. These functions are |
| locale-specific and operate on single bytes. However, it is impossible |
| to handle things correctly from an I18N standpoint by operating on |
| bytes, since characters may be multibyte. Thus <a class="link" href="glib-String-Utility-Functions.html#g-strncasecmp" title="g_strncasecmp ()"><code class="function">g_strncasecmp()</code></a> is |
| broken if your string is guaranteed to be ASCII, since it's |
| locale-sensitive, and it's broken if your string is localized, since |
| it doesn't work on many encodings at all, including UTF-8, EUC-JP, |
| etc. |
| </p> |
| <p> |
| There are therefore two replacement functions: <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strncasecmp" title="g_ascii_strncasecmp ()"><code class="function">g_ascii_strncasecmp()</code></a>, |
| which only works on ASCII and is not locale-sensitive, and |
| <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-casefold" title="g_utf8_casefold ()"><code class="function">g_utf8_casefold()</code></a>, which is good for case-insensitive sorting of UTF-8.</p> |
| </div> |
| <p> |
| A case-insensitive string comparison, corresponding to the standard |
| <code class="function">strncasecmp()</code> function on platforms which support it. |
| It is similar to <a class="link" href="glib-String-Utility-Functions.html#g-strcasecmp" title="g_strcasecmp ()"><code class="function">g_strcasecmp()</code></a> except it only compares the first <em class="parameter"><code>n</code></em> |
| characters of the strings. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>s1</code></em> :</span></p></td> |
| <td>a string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>s2</code></em> :</span></p></td> |
| <td>a string to compare with <em class="parameter"><code>s1</code></em>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td> |
| <td>the maximum number of characters to compare. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> 0 if the strings match, a negative value if <em class="parameter"><code>s1</code></em> < <em class="parameter"><code>s2</code></em>, |
| or a positive value if <em class="parameter"><code>s1</code></em> > <em class="parameter"><code>s2</code></em>. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strreverse ()"> |
| <a name="g-strreverse"></a><h3>g_strreverse ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strreverse (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre> |
| <p> |
| Reverses all of the bytes in a string. For example, |
| <code class="literal">g_strreverse ("abcdef")</code> will result |
| in "fedcba". |
| </p> |
| <p> |
| Note that <a class="link" href="glib-String-Utility-Functions.html#g-strreverse" title="g_strreverse ()"><code class="function">g_strreverse()</code></a> doesn't work on UTF-8 strings |
| containing multibyte characters. For that purpose, use |
| <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strreverse" title="g_utf8_strreverse ()"><code class="function">g_utf8_strreverse()</code></a>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>the string to reverse |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the same pointer passed in as <em class="parameter"><code>string</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_strtoll ()"> |
| <a name="g-ascii-strtoll"></a><h3>g_ascii_strtoll ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="returnvalue">gint64</span></a> g_ascii_strtoll (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *nptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> base</code></em>);</pre> |
| <p> |
| Converts a string to a <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> value. |
| This function behaves like the standard <code class="function">strtoll()</code> function |
| does in the C locale. It does this without actually |
| changing the current locale, since that would not be |
| thread-safe. |
| </p> |
| <p> |
| This function is typically used when reading configuration |
| files or other non-user input that should be locale independent. |
| To handle input from the user you should normally use the |
| locale-sensitive system <code class="function">strtoll()</code> function. |
| </p> |
| <p> |
| If the correct value would cause overflow, <a class="link" href="glib-Limits-of-Basic-Types.html#G-MAXINT64:CAPS" title="G_MAXINT64"><code class="literal">G_MAXINT64</code></a> or <a class="link" href="glib-Limits-of-Basic-Types.html#G-MININT64:CAPS" title="G_MININT64"><code class="literal">G_MININT64</code></a> |
| is returned, and <code class="literal">ERANGE</code> is stored in <code class="literal">errno</code>. If the base is |
| outside the valid range, zero is returned, and <code class="literal">EINVAL</code> is stored |
| in <code class="literal">errno</code>. If the string conversion fails, zero is returned, and |
| <em class="parameter"><code>endptr</code></em> returns <em class="parameter"><code>nptr</code></em> (if <em class="parameter"><code>endptr</code></em> is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>). |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>nptr</code></em> :</span></p></td> |
| <td>the string to convert to a numeric value. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>endptr</code></em> :</span></p></td> |
| <td>if non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, it returns the character after |
| the last character used in the conversion. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>base</code></em> :</span></p></td> |
| <td>to be used for the conversion, 2..36 or 0 |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> value or zero on error. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.12</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_strtoull ()"> |
| <a name="g-ascii-strtoull"></a><h3>g_ascii_strtoull ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="returnvalue">guint64</span></a> g_ascii_strtoull (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *nptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> base</code></em>);</pre> |
| <p> |
| Converts a string to a <a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="type">guint64</span></a> value. |
| This function behaves like the standard <code class="function">strtoull()</code> function |
| does in the C locale. It does this without actually |
| changing the current locale, since that would not be |
| thread-safe. |
| </p> |
| <p> |
| This function is typically used when reading configuration |
| files or other non-user input that should be locale independent. |
| To handle input from the user you should normally use the |
| locale-sensitive system <code class="function">strtoull()</code> function. |
| </p> |
| <p> |
| If the correct value would cause overflow, <a class="link" href="glib-Limits-of-Basic-Types.html#G-MAXUINT64:CAPS" title="G_MAXUINT64"><code class="literal">G_MAXUINT64</code></a> |
| is returned, and <code class="literal">ERANGE</code> is stored in <code class="literal">errno</code>. If the base is |
| outside the valid range, zero is returned, and <code class="literal">EINVAL</code> is stored |
| in <code class="literal">errno</code>. If the string conversion fails, zero is returned, and |
| <em class="parameter"><code>endptr</code></em> returns <em class="parameter"><code>nptr</code></em> (if <em class="parameter"><code>endptr</code></em> is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>). |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>nptr</code></em> :</span></p></td> |
| <td>the string to convert to a numeric value. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>endptr</code></em> :</span></p></td> |
| <td>if non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, it returns the character after |
| the last character used in the conversion. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>base</code></em> :</span></p></td> |
| <td>to be used for the conversion, 2..36 or 0 |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the <a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="type">guint64</span></a> value or zero on error. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.2</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="G_ASCII_DTOSTR_BUF_SIZE"> |
| <a name="G-ASCII-DTOSTR-BUF-SIZE:CAPS"></a><h3>G_ASCII_DTOSTR_BUF_SIZE</h3> |
| <pre class="programlisting">#define G_ASCII_DTOSTR_BUF_SIZE (29 + 10) |
| </pre> |
| <p> |
| A good size for a buffer to be passed into <a class="link" href="glib-String-Utility-Functions.html#g-ascii-dtostr" title="g_ascii_dtostr ()"><code class="function">g_ascii_dtostr()</code></a>. |
| It is guaranteed to be enough for all output of that function on systems with |
| 64bit IEEE-compatible doubles. |
| </p> |
| <p> |
| The typical usage would be something like: |
| </p> |
| <div class="informalexample"> |
| <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td class="listing_lines" align="right"><pre>1 |
| 2</pre></td> |
| <td class="listing_code"><pre class="programlisting"><span class="type">char</span><span class="normal"> buf</span><span class="symbol">[</span><span class="normal"><a href="glib-String-Utility-Functions.html#G-ASCII-DTOSTR-BUF-SIZE:CAPS">G_ASCII_DTOSTR_BUF_SIZE</a></span><span class="symbol">];</span> |
| <span class="function">fprintf</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">out</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"value=%s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="glib-String-Utility-Functions.html#g-ascii-dtostr">g_ascii_dtostr</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">buf</span><span class="symbol">,</span><span class="normal"> </span><span class="keyword">sizeof</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">buf</span><span class="symbol">),</span><span class="normal"> value</span><span class="symbol">));</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| <p> |
| </p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_strtod ()"> |
| <a name="g-ascii-strtod"></a><h3>g_ascii_strtod ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="returnvalue">gdouble</span></a> g_ascii_strtod (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *nptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>);</pre> |
| <p> |
| Converts a string to a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> value. |
| </p> |
| <p> |
| This function behaves like the standard <code class="function">strtod()</code> function |
| does in the C locale. It does this without actually changing |
| the current locale, since that would not be thread-safe. |
| A limitation of the implementation is that this function |
| will still accept localized versions of infinities and NANs. |
| </p> |
| <p> |
| This function is typically used when reading configuration |
| files or other non-user input that should be locale independent. |
| To handle input from the user you should normally use the |
| locale-sensitive system <code class="function">strtod()</code> function. |
| </p> |
| <p> |
| To convert from a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> to a string in a locale-insensitive |
| way, use <a class="link" href="glib-String-Utility-Functions.html#g-ascii-dtostr" title="g_ascii_dtostr ()"><code class="function">g_ascii_dtostr()</code></a>. |
| </p> |
| <p> |
| If the correct value would cause overflow, plus or minus <code class="literal">HUGE_VAL</code> |
| is returned (according to the sign of the value), and <code class="literal">ERANGE</code> is |
| stored in <code class="literal">errno</code>. If the correct value would cause underflow, |
| zero is returned and <code class="literal">ERANGE</code> is stored in <code class="literal">errno</code>. |
| </p> |
| <p> |
| This function resets <code class="literal">errno</code> before calling <code class="function">strtod()</code> so that |
| you can reliably detect overflow and underflow. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>nptr</code></em> :</span></p></td> |
| <td>the string to convert to a numeric value. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>endptr</code></em> :</span></p></td> |
| <td>if non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, it returns the character after |
| the last character used in the conversion. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> value. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_dtostr ()"> |
| <a name="g-ascii-dtostr"></a><h3>g_ascii_dtostr ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_ascii_dtostr (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *buffer</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> buf_len</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> d</code></em>);</pre> |
| <p> |
| Converts a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> to a string, using the '.' as |
| decimal point. |
| </p> |
| <p> |
| This functions generates enough precision that converting |
| the string back using <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strtod" title="g_ascii_strtod ()"><code class="function">g_ascii_strtod()</code></a> gives the same machine-number |
| (on machines with IEEE compatible 64bit doubles). It is |
| guaranteed that the size of the resulting string will never |
| be larger than <em class="parameter"><code>G_ASCII_DTOSTR_BUF_SIZE</code></em> bytes. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td> |
| <td>A buffer to place the resulting string in |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>buf_len</code></em> :</span></p></td> |
| <td>The length of the buffer. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>d</code></em> :</span></p></td> |
| <td>The <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> to convert |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> The pointer to the buffer with the converted string. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_ascii_formatd ()"> |
| <a name="g-ascii-formatd"></a><h3>g_ascii_formatd ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_ascii_formatd (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *buffer</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> buf_len</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> d</code></em>);</pre> |
| <p> |
| Converts a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> to a string, using the '.' as |
| decimal point. To format the number you pass in |
| a <code class="function">printf()</code>-style format string. Allowed conversion |
| specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'. |
| </p> |
| <p> |
| If you just want to want to serialize the value into a |
| string, use <a class="link" href="glib-String-Utility-Functions.html#g-ascii-dtostr" title="g_ascii_dtostr ()"><code class="function">g_ascii_dtostr()</code></a>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td> |
| <td>A buffer to place the resulting string in |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>buf_len</code></em> :</span></p></td> |
| <td>The length of the buffer. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>The <code class="function">printf()</code>-style format to use for the |
| code to use for converting. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>d</code></em> :</span></p></td> |
| <td>The <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> to convert |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> The pointer to the buffer with the converted string. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strtod ()"> |
| <a name="g-strtod"></a><h3>g_strtod ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="returnvalue">gdouble</span></a> g_strtod (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *nptr</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>);</pre> |
| <p> |
| Converts a string to a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> value. |
| It calls the standard <code class="function">strtod()</code> function to handle the conversion, but |
| if the string is not completely converted it attempts the conversion |
| again with <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strtod" title="g_ascii_strtod ()"><code class="function">g_ascii_strtod()</code></a>, and returns the best match. |
| </p> |
| <p> |
| This function should seldomly be used. The normal situation when reading |
| numbers not for human consumption is to use <a class="link" href="glib-String-Utility-Functions.html#g-ascii-strtod" title="g_ascii_strtod ()"><code class="function">g_ascii_strtod()</code></a>. Only when |
| you know that you must expect both locale formatted and C formatted numbers |
| should you use this. Make sure that you don't pass strings such as comma |
| separated lists of values, since the commas may be interpreted as a decimal |
| point in some locales, causing unexpected results. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>nptr</code></em> :</span></p></td> |
| <td>the string to convert to a numeric value. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>endptr</code></em> :</span></p></td> |
| <td>if non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, it returns the character after |
| the last character used in the conversion. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> the <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> value. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strchug ()"> |
| <a name="g-strchug"></a><h3>g_strchug ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strchug (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre> |
| <p> |
| Removes leading whitespace from a string, by moving the rest of the |
| characters forward. |
| </p> |
| <p> |
| This function doesn't allocate or reallocate any memory; it modifies <em class="parameter"><code>string</code></em> |
| in place. The pointer to <em class="parameter"><code>string</code></em> is returned to allow the nesting of functions. |
| </p> |
| <p> |
| Also see <a class="link" href="glib-String-Utility-Functions.html#g-strchomp" title="g_strchomp ()"><code class="function">g_strchomp()</code></a> and <a class="link" href="glib-String-Utility-Functions.html#g-strstrip" title="g_strstrip()"><code class="function">g_strstrip()</code></a>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a string to remove the leading whitespace from. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <em class="parameter"><code>string</code></em>. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strchomp ()"> |
| <a name="g-strchomp"></a><h3>g_strchomp ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strchomp (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre> |
| <p> |
| Removes trailing whitespace from a string. |
| </p> |
| <p> |
| This function doesn't allocate or reallocate any memory; it modifies <em class="parameter"><code>string</code></em> in |
| place. The pointer to <em class="parameter"><code>string</code></em> is returned to allow the nesting of functions. |
| </p> |
| <p> |
| Also see <a class="link" href="glib-String-Utility-Functions.html#g-strchug" title="g_strchug ()"><code class="function">g_strchug()</code></a> and <a class="link" href="glib-String-Utility-Functions.html#g-strstrip" title="g_strstrip()"><code class="function">g_strstrip()</code></a>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a string to remove the trailing whitespace from. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <em class="parameter"><code>string</code></em>. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strstrip()"> |
| <a name="g-strstrip"></a><h3>g_strstrip()</h3> |
| <pre class="programlisting">#define g_strstrip( string )</pre> |
| <p> |
| Removes leading and trailing whitespace from a string. See <a class="link" href="glib-String-Utility-Functions.html#g-strchomp" title="g_strchomp ()"><code class="function">g_strchomp()</code></a> and |
| <a class="link" href="glib-String-Utility-Functions.html#g-strchug" title="g_strchug ()"><code class="function">g_strchug()</code></a>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody><tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a string to remove the leading and trailing whitespace from. |
| </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strdelimit ()"> |
| <a name="g-strdelimit"></a><h3>g_strdelimit ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strdelimit (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *delimiters</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> new_delimiter</code></em>);</pre> |
| <p> |
| Converts any delimiter characters in <em class="parameter"><code>string</code></em> to <em class="parameter"><code>new_delimiter</code></em>. |
| Any characters in <em class="parameter"><code>string</code></em> which are found in <em class="parameter"><code>delimiters</code></em> are changed |
| to the <em class="parameter"><code>new_delimiter</code></em> character. Modifies <em class="parameter"><code>string</code></em> in place, and returns |
| <em class="parameter"><code>string</code></em> itself, not a copy. The return value is to allow nesting such as |
| <code class="literal">g_ascii_strup (g_strdelimit (str, "abc", '?'))</code>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>the string to convert. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>delimiters</code></em> :</span></p></td> |
| <td>a string containing the current delimiters, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to use the |
| standard delimiters defined in <a class="link" href="glib-String-Utility-Functions.html#G-STR-DELIMITERS:CAPS" title="G_STR_DELIMITERS"><span class="type">G_STR_DELIMITERS</span></a>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>new_delimiter</code></em> :</span></p></td> |
| <td>the new delimiter character. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <em class="parameter"><code>string</code></em>. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="G_STR_DELIMITERS"> |
| <a name="G-STR-DELIMITERS:CAPS"></a><h3>G_STR_DELIMITERS</h3> |
| <pre class="programlisting">#define G_STR_DELIMITERS "_-|> <." |
| </pre> |
| <p> |
| The standard delimiters, used in <a class="link" href="glib-String-Utility-Functions.html#g-strdelimit" title="g_strdelimit ()"><code class="function">g_strdelimit()</code></a>. |
| </p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strescape ()"> |
| <a name="g-strescape"></a><h3>g_strescape ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strescape (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *source</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *exceptions</code></em>);</pre> |
| <p> |
| Escapes the special characters '\b', '\f', '\n', '\r', '\t', '\' and |
| '"' in the string <em class="parameter"><code>source</code></em> by inserting a '\' before |
| them. Additionally all characters in the range 0x01-0x1F (everything |
| below SPACE) and in the range 0x7F-0xFF (all non-ASCII chars) are |
| replaced with a '\' followed by their octal representation. Characters |
| supplied in <em class="parameter"><code>exceptions</code></em> are not escaped. |
| </p> |
| <p> |
| <a class="link" href="glib-String-Utility-Functions.html#g-strcompress" title="g_strcompress ()"><code class="function">g_strcompress()</code></a> does the reverse conversion. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>source</code></em> :</span></p></td> |
| <td>a string to escape. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>exceptions</code></em> :</span></p></td> |
| <td>a string of characters not to escape in <em class="parameter"><code>source</code></em>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a newly-allocated copy of <em class="parameter"><code>source</code></em> with certain |
| characters escaped. See above. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strcompress ()"> |
| <a name="g-strcompress"></a><h3>g_strcompress ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strcompress (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *source</code></em>);</pre> |
| <p> |
| Replaces all escaped characters with their one byte equivalent. It |
| does the reverse conversion of <a class="link" href="glib-String-Utility-Functions.html#g-strescape" title="g_strescape ()"><code class="function">g_strescape()</code></a>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>source</code></em> :</span></p></td> |
| <td>a string to compress. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a newly-allocated copy of <em class="parameter"><code>source</code></em> with all escaped |
| character compressed. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strcanon ()"> |
| <a name="g-strcanon"></a><h3>g_strcanon ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strcanon (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *valid_chars</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> substitutor</code></em>);</pre> |
| <p> |
| For each character in <em class="parameter"><code>string</code></em>, if the character is not in <em class="parameter"><code>valid_chars</code></em>, |
| replaces the character with <em class="parameter"><code>substitutor</code></em>. Modifies <em class="parameter"><code>string</code></em> in place, |
| and return <em class="parameter"><code>string</code></em> itself, not a copy. The return value is to allow |
| nesting such as <code class="literal">g_ascii_strup (g_strcanon (str, "abc", '?'))</code>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a nul-terminated array of bytes. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>valid_chars</code></em> :</span></p></td> |
| <td>bytes permitted in <em class="parameter"><code>string</code></em>. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>substitutor</code></em> :</span></p></td> |
| <td>replacement character for disallowed bytes. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <em class="parameter"><code>string</code></em>. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strsplit ()"> |
| <a name="g-strsplit"></a><h3>g_strsplit ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>** g_strsplit (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *delimiter</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> max_tokens</code></em>);</pre> |
| <p> |
| Splits a string into a maximum of <em class="parameter"><code>max_tokens</code></em> pieces, using the given |
| <em class="parameter"><code>delimiter</code></em>. If <em class="parameter"><code>max_tokens</code></em> is reached, the remainder of <em class="parameter"><code>string</code></em> is appended |
| to the last token. |
| </p> |
| <p> |
| As a special case, the result of splitting the empty string "" is an empty |
| vector, not a vector containing a single string. The reason for this |
| special case is that being able to represent a empty vector is typically |
| more useful than consistent handling of empty elements. If you do need |
| to represent empty elements, you'll need to check for the empty string |
| before calling <a class="link" href="glib-String-Utility-Functions.html#g-strsplit" title="g_strsplit ()"><code class="function">g_strsplit()</code></a>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a string to split. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>delimiter</code></em> :</span></p></td> |
| <td>a string which specifies the places at which to split the string. |
| The delimiter is not included in any of the resulting strings, unless |
| <em class="parameter"><code>max_tokens</code></em> is reached. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>max_tokens</code></em> :</span></p></td> |
| <td>the maximum number of pieces to split <em class="parameter"><code>string</code></em> into. If this is |
| less than 1, the string is split completely. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings. Use |
| <a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a> to free it. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strsplit_set ()"> |
| <a name="g-strsplit-set"></a><h3>g_strsplit_set ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> ** g_strsplit_set (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>, |
| <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *delimiters</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> max_tokens</code></em>);</pre> |
| <p> |
| Splits <em class="parameter"><code>string</code></em> into a number of tokens not containing any of the characters |
| in <em class="parameter"><code>delimiter</code></em>. A token is the (possibly empty) longest string that does not |
| contain any of the characters in <em class="parameter"><code>delimiters</code></em>. If <em class="parameter"><code>max_tokens</code></em> is reached, the |
| remainder is appended to the last token. |
| </p> |
| <p> |
| For example the result of g_strsplit_set ("abc:def/ghi", ":/", -1) is a |
| <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated vector containing the three strings "abc", "def", |
| and "ghi". |
| </p> |
| <p> |
| The result if g_strsplit_set (":def/ghi:", ":/", -1) is a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated |
| vector containing the four strings "", "def", "ghi", and "". |
| </p> |
| <p> |
| As a special case, the result of splitting the empty string "" is an empty |
| vector, not a vector containing a single string. The reason for this |
| special case is that being able to represent a empty vector is typically |
| more useful than consistent handling of empty elements. If you do need |
| to represent empty elements, you'll need to check for the empty string |
| before calling <a class="link" href="glib-String-Utility-Functions.html#g-strsplit-set" title="g_strsplit_set ()"><code class="function">g_strsplit_set()</code></a>. |
| </p> |
| <p> |
| Note that this function works on bytes not characters, so it can't be used |
| to delimit UTF-8 strings for anything but ASCII characters. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>The string to be tokenized |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>delimiters</code></em> :</span></p></td> |
| <td>A nul-terminated string containing bytes that are used |
| to split the string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>max_tokens</code></em> :</span></p></td> |
| <td>The maximum number of tokens to split <em class="parameter"><code>string</code></em> into. |
| If this is less than 1, the string is split completely |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings. Use |
| <a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a> to free it. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.4</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strfreev ()"> |
| <a name="g-strfreev"></a><h3>g_strfreev ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> g_strfreev (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **str_array</code></em>);</pre> |
| <p> |
| Frees a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings, and the array itself. |
| If called on a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> value, <a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a> simply returns. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody><tr> |
| <td><p><span class="term"><em class="parameter"><code>str_array</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings to free. |
| </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strconcat ()"> |
| <a name="g-strconcat"></a><h3>g_strconcat ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strconcat (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string1</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p> |
| Concatenates all of the given strings into one long string. |
| The returned string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when no longer needed. |
| </p> |
| <p> |
| </p> |
| <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| <h3 class="title">Warning</h3> |
| <p>The variable argument list <span class="emphasis"><em>must</em></span> end |
| with <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. If you forget the <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-strconcat" title="g_strconcat ()"><code class="function">g_strconcat()</code></a> will start appending |
| random memory junk to your string.</p> |
| </div> |
| <p> |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string1</code></em> :</span></p></td> |
| <td>the first string to add, which must not be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated list of strings to append to the string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated string containing all the string arguments |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strjoin ()"> |
| <a name="g-strjoin"></a><h3>g_strjoin ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strjoin (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *separator</code></em>, |
| <em class="parameter"><code>...</code></em>);</pre> |
| <p> |
| Joins a number of strings together to form one long string, with the |
| optional <em class="parameter"><code>separator</code></em> inserted between each of them. The returned string |
| should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>separator</code></em> :</span></p></td> |
| <td>a string to insert between each of the strings, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated list of strings to join |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated string containing all of the strings joined |
| together, with <em class="parameter"><code>separator</code></em> between them |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strjoinv ()"> |
| <a name="g-strjoinv"></a><h3>g_strjoinv ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strjoinv (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *separator</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **str_array</code></em>);</pre> |
| <p> |
| Joins a number of strings together to form one long string, with the |
| optional <em class="parameter"><code>separator</code></em> inserted between each of them. The returned string |
| should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>separator</code></em> :</span></p></td> |
| <td>a string to insert between each of the strings, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str_array</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings to join |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a newly-allocated string containing all of the strings joined |
| together, with <em class="parameter"><code>separator</code></em> between them |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strv_length ()"> |
| <a name="g-strv-length"></a><h3>g_strv_length ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a> g_strv_length (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **str_array</code></em>);</pre> |
| <p> |
| Returns the length of the given <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated |
| string array <em class="parameter"><code>str_array</code></em>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>str_array</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings. |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> length of <em class="parameter"><code>str_array</code></em>. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.6</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strerror ()"> |
| <a name="g-strerror"></a><h3>g_strerror ()</h3> |
| <pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strerror (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> errnum</code></em>);</pre> |
| <p> |
| Returns a string corresponding to the given error code, e.g. |
| "no such process". You should use this function in preference to |
| <code class="function">strerror()</code>, because it returns a string in UTF-8 encoding, and since |
| not all platforms support the <code class="function">strerror()</code> function. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>errnum</code></em> :</span></p></td> |
| <td>the system error number. See the standard C <code class="literal">errno</code> |
| documentation |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a UTF-8 string describing the error code. If the error code |
| is unknown, it returns "unknown error (<code>)". The string |
| can only be used until the next call to <a class="link" href="glib-String-Utility-Functions.html#g-strerror" title="g_strerror ()"><code class="function">g_strerror()</code></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_strsignal ()"> |
| <a name="g-strsignal"></a><h3>g_strsignal ()</h3> |
| <pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_strsignal (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> signum</code></em>);</pre> |
| <p> |
| Returns a string describing the given signal, e.g. "Segmentation fault". |
| You should use this function in preference to <code class="function">strsignal()</code>, because it |
| returns a string in UTF-8 encoding, and since not all platforms support |
| the <code class="function">strsignal()</code> function. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>signum</code></em> :</span></p></td> |
| <td>the signal number. See the <code class="literal">signal</code> |
| documentation |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> a UTF-8 string describing the signal. If the signal is unknown, |
| it returns "unknown signal (<signum>)". The string can only be |
| used until the next call to <a class="link" href="glib-String-Utility-Functions.html#g-strsignal" title="g_strsignal ()"><code class="function">g_strsignal()</code></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| </div> |
| <div class="footer"> |
| <hr> |
| Generated by GTK-Doc V1.14</div> |
| </body> |
| </html> |