File: //usr/local/ssl/share/gtk-doc/html/glib/glib-String-Utility-Functions.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>String Utility Functions</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" 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.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
</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"><nobr><a href="#id2981448" class="shortcut">Top</a>
 | 
<a href="#id2983556" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="glib-String-Utility-Functions"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2981448"></a><span class="refentrytitle">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">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <glib.h>
#include <glib/gprintf.h>
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strdup">g_strdup</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strndup">g_strndup</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,
<a href="glib-Basic-Types.html#gsize">gsize</a> n);
<a href="glib-Basic-Types.html#gchar">gchar</a>** <a href="glib-String-Utility-Functions.html#g-strdupv">g_strdupv</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> **str_array);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strnfill">g_strnfill</a> (<a href="glib-Basic-Types.html#gsize">gsize</a> length,
<a href="glib-Basic-Types.html#gchar">gchar</a> fill_char);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-stpcpy">g_stpcpy</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *dest,
const char *src);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strstr-len">g_strstr_len</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *haystack,
<a href="glib-Basic-Types.html#gssize">gssize</a> haystack_len,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *needle);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strrstr">g_strrstr</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *haystack,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *needle);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strrstr-len">g_strrstr_len</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *haystack,
<a href="glib-Basic-Types.html#gssize">gssize</a> haystack_len,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *needle);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-str-has-prefix">g_str_has_prefix</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *prefix);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-str-has-suffix">g_str_has_suffix</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *suffix);
<a href="glib-Basic-Types.html#gsize">gsize</a> <a href="glib-String-Utility-Functions.html#g-strlcpy">g_strlcpy</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *dest,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *src,
<a href="glib-Basic-Types.html#gsize">gsize</a> dest_size);
<a href="glib-Basic-Types.html#gsize">gsize</a> <a href="glib-String-Utility-Functions.html#g-strlcat">g_strlcat</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *dest,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *src,
<a href="glib-Basic-Types.html#gsize">gsize</a> dest_size);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strdup-printf">g_strdup_printf</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *format,
...);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strdup-vprintf">g_strdup_vprintf</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *format,
va_list args);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-printf">g_printf</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
...);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-vprintf">g_vprintf</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
va_list args);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-fprintf">g_fprintf</a> (FILE *file,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
...);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-vfprintf">g_vfprintf</a> (FILE *file,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
va_list args);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-sprintf">g_sprintf</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
...);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-vsprintf">g_vsprintf</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
va_list args);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-snprintf">g_snprintf</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
<a href="glib-Basic-Types.html#gulong">gulong</a> n,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
...);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-vsnprintf">g_vsnprintf</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
<a href="glib-Basic-Types.html#gulong">gulong</a> n,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
va_list args);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-vasprintf">g_vasprintf</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> **string,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
va_list args);
<a href="glib-Basic-Types.html#gsize">gsize</a> <a href="glib-String-Utility-Functions.html#g-printf-string-upper-bound">g_printf_string_upper_bound</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *format,
va_list args);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-isalnum">g_ascii_isalnum</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-isalpha">g_ascii_isalpha</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-iscntrl">g_ascii_iscntrl</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-isdigit">g_ascii_isdigit</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-isgraph">g_ascii_isgraph</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-islower">g_ascii_islower</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-isprint">g_ascii_isprint</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-ispunct">g_ascii_ispunct</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-isspace">g_ascii_isspace</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-isupper">g_ascii_isupper</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-String-Utility-Functions.html#g-ascii-isxdigit">g_ascii_isxdigit</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-ascii-digit-value">g_ascii_digit_value</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-ascii-xdigit-value">g_ascii_xdigit_value</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-ascii-strcasecmp">g_ascii_strcasecmp</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *s1,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *s2);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-ascii-strncasecmp">g_ascii_strncasecmp</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *s1,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *s2,
<a href="glib-Basic-Types.html#gsize">gsize</a> n);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-ascii-strup">g_ascii_strup</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,
<a href="glib-Basic-Types.html#gssize">gssize</a> len);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-ascii-strdown">g_ascii_strdown</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,
<a href="glib-Basic-Types.html#gssize">gssize</a> len);
<a href="glib-Basic-Types.html#gchar">gchar</a> <a href="glib-String-Utility-Functions.html#g-ascii-tolower">g_ascii_tolower</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Basic-Types.html#gchar">gchar</a> <a href="glib-String-Utility-Functions.html#g-ascii-toupper">g_ascii_toupper</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> c);
<a href="glib-Strings.html#GString">GString</a>* <a href="glib-String-Utility-Functions.html#g-string-ascii-up">g_string_ascii_up</a> (<a href="glib-Strings.html#GString">GString</a> *string);
<a href="glib-Strings.html#GString">GString</a>* <a href="glib-String-Utility-Functions.html#g-string-ascii-down">g_string_ascii_down</a> (<a href="glib-Strings.html#GString">GString</a> *string);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strup">g_strup</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strdown">g_strdown</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-strcasecmp">g_strcasecmp</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *s1,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *s2);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-String-Utility-Functions.html#g-strncasecmp">g_strncasecmp</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *s1,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *s2,
<a href="glib-Basic-Types.html#guint">guint</a> n);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strreverse">g_strreverse</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string);
<a href="glib-Basic-Types.html#gint64">gint64</a> <a href="glib-String-Utility-Functions.html#g-ascii-strtoll">g_ascii_strtoll</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *nptr,
<a href="glib-Basic-Types.html#gchar">gchar</a> **endptr,
<a href="glib-Basic-Types.html#guint">guint</a> base);
<a href="glib-Basic-Types.html#guint64">guint64</a> <a href="glib-String-Utility-Functions.html#g-ascii-strtoull">g_ascii_strtoull</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *nptr,
<a href="glib-Basic-Types.html#gchar">gchar</a> **endptr,
<a href="glib-Basic-Types.html#guint">guint</a> base);
#define <a href="glib-String-Utility-Functions.html#G-ASCII-DTOSTR-BUF-SIZE:CAPS">G_ASCII_DTOSTR_BUF_SIZE</a>
<a href="glib-Basic-Types.html#gdouble">gdouble</a> <a href="glib-String-Utility-Functions.html#g-ascii-strtod">g_ascii_strtod</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *nptr,
<a href="glib-Basic-Types.html#gchar">gchar</a> **endptr);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-ascii-dtostr">g_ascii_dtostr</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *buffer,
<a href="glib-Basic-Types.html#gint">gint</a> buf_len,
<a href="glib-Basic-Types.html#gdouble">gdouble</a> d);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-ascii-formatd">g_ascii_formatd</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *buffer,
<a href="glib-Basic-Types.html#gint">gint</a> buf_len,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *format,
<a href="glib-Basic-Types.html#gdouble">gdouble</a> d);
<a href="glib-Basic-Types.html#gdouble">gdouble</a> <a href="glib-String-Utility-Functions.html#g-strtod">g_strtod</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *nptr,
<a href="glib-Basic-Types.html#gchar">gchar</a> **endptr);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strchug">g_strchug</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strchomp">g_strchomp</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string);
#define <a href="glib-String-Utility-Functions.html#g-strstrip">g_strstrip</a> ( string )
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strdelimit">g_strdelimit</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *delimiters,
<a href="glib-Basic-Types.html#gchar">gchar</a> new_delimiter);
#define <a href="glib-String-Utility-Functions.html#G-STR-DELIMITERS:CAPS">G_STR_DELIMITERS</a>
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strescape">g_strescape</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *source,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *exceptions);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strcompress">g_strcompress</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *source);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strcanon">g_strcanon</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *valid_chars,
<a href="glib-Basic-Types.html#gchar">gchar</a> substitutor);
<a href="glib-Basic-Types.html#gchar">gchar</a>** <a href="glib-String-Utility-Functions.html#g-strsplit">g_strsplit</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *delimiter,
<a href="glib-Basic-Types.html#gint">gint</a> max_tokens);
<a href="glib-Basic-Types.html#gchar">gchar</a>** <a href="glib-String-Utility-Functions.html#g-strsplit-set">g_strsplit_set</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *delimiters,
<a href="glib-Basic-Types.html#gint">gint</a> max_tokens);
void <a href="glib-String-Utility-Functions.html#g-strfreev">g_strfreev</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> **str_array);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strconcat">g_strconcat</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string1,
...);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strjoin">g_strjoin</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *separator,
...);
<a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strjoinv">g_strjoinv</a> (const <a href="glib-Basic-Types.html#gchar">gchar</a> *separator,
<a href="glib-Basic-Types.html#gchar">gchar</a> **str_array);
<a href="glib-Basic-Types.html#guint">guint</a> <a href="glib-String-Utility-Functions.html#g-strv-length">g_strv_length</a> (<a href="glib-Basic-Types.html#gchar">gchar</a> **str_array);
const <a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strerror">g_strerror</a> (<a href="glib-Basic-Types.html#gint">gint</a> errnum);
const <a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-String-Utility-Functions.html#g-strsignal">g_strsignal</a> (<a href="glib-Basic-Types.html#gint">gint</a> signum);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2983556"></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 href="glib-String-Utility-Functions.html#g-printf"><code class="function">g_printf()</code></a>, <a href="glib-String-Utility-Functions.html#g-fprintf"><code class="function">g_fprintf()</code></a>, <a href="glib-String-Utility-Functions.html#g-sprintf"><code class="function">g_sprintf()</code></a>, <a href="glib-String-Utility-Functions.html#g-snprintf"><code class="function">g_snprintf()</code></a>,
<a href="glib-String-Utility-Functions.html#g-vprintf"><code class="function">g_vprintf()</code></a>, <a href="glib-String-Utility-Functions.html#g-vfprintf"><code class="function">g_vfprintf()</code></a>, <a href="glib-String-Utility-Functions.html#g-vsprintf"><code class="function">g_vsprintf()</code></a> and <a href="glib-String-Utility-Functions.html#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 href="glib-Unicode-Manipulation.html#g-unichar-iswide"><code class="function">g_unichar_iswide()</code></a>) into account.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2983784"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2983795"></a><h3>
<a name="g-strdup"></a>g_strdup ()</h3>
<a class="indexterm" name="id2983807"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strdup (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str);</pre>
<p>
Duplicates a string.
If <em class="parameter"><code>str</code></em> is <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> it returns <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
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>
<span class="term"><em class="parameter"><code>str</code></em> :</span></td>
<td>the string to duplicate.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>a newly-allocated copy of <em class="parameter"><code>str</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2983898"></a><h3>
<a name="g-strndup"></a>g_strndup ()</h3>
<a class="indexterm" name="id2983911"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strndup (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,
<a href="glib-Basic-Types.html#gsize">gsize</a> n);</pre>
<p>
Duplicates the first <em class="parameter"><code>n</code></em> characters of a string, returning a newly-allocated
buffer <em class="parameter"><code>n</code></em> + 1 characters 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> characters long the buffer is padded with nuls.
If <em class="parameter"><code>str</code></em> is <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> it returns <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
The returned value should be freed when no longer needed.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>str</code></em> :</span></td>
<td>the string to duplicate part of.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>n</code></em> :</span></td>
<td>the maximum number of characters to copy from <em class="parameter"><code>str</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>a newly-allocated buffer containing the first <em class="parameter"><code>n</code></em> characters of <em class="parameter"><code>str</code></em>,
nul-terminated.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2984061"></a><h3>
<a name="g-strdupv"></a>g_strdupv ()</h3>
<a class="indexterm" name="id2984074"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>** g_strdupv (<a href="glib-Basic-Types.html#gchar">gchar</a> **str_array);</pre>
<p>
Copies <a href="glib-Standard-Macros.html#NULL:CAPS"><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 href="glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a> does this for you. If called
on a <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> value, <a href="glib-String-Utility-Functions.html#g-strdupv"><code class="function">g_strdupv()</code></a> simply returns <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>str_array</code></em> :</span></td>
<td> <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2984208"></a><h3>
<a name="g-strnfill"></a>g_strnfill ()</h3>
<a class="indexterm" name="id2984221"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strnfill (<a href="glib-Basic-Types.html#gsize">gsize</a> length,
<a href="glib-Basic-Types.html#gchar">gchar</a> fill_char);</pre>
<p>
Creates a new string <em class="parameter"><code>length</code></em> characters 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>
<span class="term"><em class="parameter"><code>length</code></em> :</span></td>
<td>the length of the new string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>fill_char</code></em> :</span></td>
<td>the character to fill the string with.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2984320"></a><h3>
<a name="g-stpcpy"></a>g_stpcpy ()</h3>
<a class="indexterm" name="id2984333"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_stpcpy (<a href="glib-Basic-Types.html#gchar">gchar</a> *dest,
const char *src);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest</code></em> :</span></td>
<td> destination buffer.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> source string.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a pointer to trailing nul byte.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2984419"></a><h3>
<a name="g-strstr-len"></a>g_strstr_len ()</h3>
<a class="indexterm" name="id2984432"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strstr_len (const <a href="glib-Basic-Types.html#gchar">gchar</a> *haystack,
<a href="glib-Basic-Types.html#gssize">gssize</a> haystack_len,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *needle);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>haystack</code></em> :</span></td>
<td> a string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>haystack_len</code></em> :</span></td>
<td> the maximum length of <em class="parameter"><code>haystack</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>needle</code></em> :</span></td>
<td> the string to search for.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a pointer to the found occurrence, or
<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not found.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2984571"></a><h3>
<a name="g-strrstr"></a>g_strrstr ()</h3>
<a class="indexterm" name="id2984584"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strrstr (const <a href="glib-Basic-Types.html#gchar">gchar</a> *haystack,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *needle);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>haystack</code></em> :</span></td>
<td> a nul-terminated string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>needle</code></em> :</span></td>
<td> the nul-terminated string to search for.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a pointer to the found occurrence, or
<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not found.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2984690"></a><h3>
<a name="g-strrstr-len"></a>g_strrstr_len ()</h3>
<a class="indexterm" name="id2984702"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strrstr_len (const <a href="glib-Basic-Types.html#gchar">gchar</a> *haystack,
<a href="glib-Basic-Types.html#gssize">gssize</a> haystack_len,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *needle);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>haystack</code></em> :</span></td>
<td> a nul-terminated string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>haystack_len</code></em> :</span></td>
<td> the maximum length of <em class="parameter"><code>haystack</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>needle</code></em> :</span></td>
<td> the nul-terminated string to search for.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a pointer to the found occurrence, or
<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not found.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2984842"></a><h3>
<a name="g-str-has-prefix"></a>g_str_has_prefix ()</h3>
<a class="indexterm" name="id2984858"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_str_has_prefix (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *prefix);</pre>
<p>
Looks whether the string <em class="parameter"><code>str</code></em> begins with <em class="parameter"><code>prefix</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>str</code></em> :</span></td>
<td> a nul-terminated string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>prefix</code></em> :</span></td>
<td> the nul-terminated prefix to look for.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>str</code></em> begins with <em class="parameter"><code>prefix</code></em>, <a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2984988"></a><h3>
<a name="g-str-has-suffix"></a>g_str_has_suffix ()</h3>
<a class="indexterm" name="id2985003"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_str_has_suffix (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *suffix);</pre>
<p>
Looks whether the string <em class="parameter"><code>str</code></em> ends with <em class="parameter"><code>suffix</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>str</code></em> :</span></td>
<td> a nul-terminated string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>suffix</code></em> :</span></td>
<td> the nul-terminated suffix to look for.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>str</code></em> end with <em class="parameter"><code>suffix</code></em>, <a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2985133"></a><h3>
<a name="g-strlcpy"></a>g_strlcpy ()</h3>
<a class="indexterm" name="id2985146"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gsize">gsize</a> g_strlcpy (<a href="glib-Basic-Types.html#gchar">gchar</a> *dest,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *src,
<a href="glib-Basic-Types.html#gsize">gsize</a> dest_size);</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. 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 href="glib-String-Utility-Functions.html#g-strdup"><code class="function">g_strdup()</code></a> is
an even better idea.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest</code></em> :</span></td>
<td>destination buffer
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td>source buffer
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_size</code></em> :</span></td>
<td>length of <em class="parameter"><code>dest</code></em> in bytes
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>length of <em class="parameter"><code>src</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2985356"></a><h3>
<a name="g-strlcat"></a>g_strlcat ()</h3>
<a class="indexterm" name="id2985369"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gsize">gsize</a> g_strlcat (<a href="glib-Basic-Types.html#gchar">gchar</a> *dest,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *src,
<a href="glib-Basic-Types.html#gsize">gsize</a> dest_size);</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>. 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 href="glib-String-Utility-Functions.html#g-strconcat"><code class="function">g_strconcat()</code></a> is harder to mess up.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest</code></em> :</span></td>
<td>destination buffer, already containing one nul-terminated string
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td>source buffer
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_size</code></em> :</span></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>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>length of <em class="parameter"><code>src</code></em> plus initial length of string in <em class="parameter"><code>dest</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2985573"></a><h3>
<a name="g-strdup-printf"></a>g_strdup_printf ()</h3>
<a class="indexterm" name="id2985586"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strdup_printf (const <a href="glib-Basic-Types.html#gchar">gchar</a> *format,
...);</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 when no longer needed.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td>a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td>the parameters to insert into the format string.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>a newly-allocated string holding the result.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2985692"></a><h3>
<a name="g-strdup-vprintf"></a>g_strdup_vprintf ()</h3>
<a class="indexterm" name="id2985705"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strdup_vprintf (const <a href="glib-Basic-Types.html#gchar">gchar</a> *format,
va_list args);</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 when no longer needed.
</p>
<p>
See also <a href="glib-String-Utility-Functions.html#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>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td>a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>args</code></em> :</span></td>
<td>the list of parameters to insert into the format string.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>a newly-allocated string holding the result.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2985833"></a><h3>
<a name="g-printf"></a>g_printf ()</h3>
<a class="indexterm" name="id2985848"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_printf (<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
...);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td> a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td> the arguments to insert in the output.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of characters printed.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2985958"></a><h3>
<a name="g-vprintf"></a>g_vprintf ()</h3>
<a class="indexterm" name="id2985973"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_vprintf (<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
va_list args);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td> a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>args</code></em> :</span></td>
<td> the list of arguments to insert in the output.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of characters printed.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986092"></a><h3>
<a name="g-fprintf"></a>g_fprintf ()</h3>
<a class="indexterm" name="id2986106"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_fprintf (FILE *file,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
...);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>file</code></em> :</span></td>
<td> the stream to write to.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td> a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td> the arguments to insert in the output.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of characters printed.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986240"></a><h3>
<a name="g-vfprintf"></a>g_vfprintf ()</h3>
<a class="indexterm" name="id2986254"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_vfprintf (FILE *file,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
va_list args);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>file</code></em> :</span></td>
<td> the stream to write to.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td> a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>args</code></em> :</span></td>
<td> the list of arguments to insert in the output.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of characters printed.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986394"></a><h3>
<a name="g-sprintf"></a>g_sprintf ()</h3>
<a class="indexterm" name="id2986408"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_sprintf (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
...);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> the buffer to hold the output.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td> a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td> the arguments to insert in the output.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of characters printed.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986541"></a><h3>
<a name="g-vsprintf"></a>g_vsprintf ()</h3>
<a class="indexterm" name="id2986555"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_vsprintf (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
va_list args);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> the buffer to hold the output.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td> a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>args</code></em> :</span></td>
<td> the list of arguments to insert in the output.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of characters printed.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986694"></a><h3>
<a name="g-snprintf"></a>g_snprintf ()</h3>
<a class="indexterm" name="id2986707"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_snprintf (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
<a href="glib-Basic-Types.html#gulong">gulong</a> n,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
...);</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 href="glib-String-Utility-Functions.html#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 href="glib-String-Utility-Functions.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> the buffer to hold the output.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>n</code></em> :</span></td>
<td> the maximum number of characters to produce (including the
terminating nul character).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td> a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td> the arguments to insert in the output.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of characters which would be produced if the buffer
was large enough.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986929"></a><h3>
<a name="g-vsnprintf"></a>g_vsnprintf ()</h3>
<a class="indexterm" name="id2986941"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_vsnprintf (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
<a href="glib-Basic-Types.html#gulong">gulong</a> n,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
va_list args);</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 href="glib-String-Utility-Functions.html#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 href="glib-String-Utility-Functions.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> the buffer to hold the output.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>n</code></em> :</span></td>
<td> the maximum number of characters to produce (including the
terminating nul character).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td> a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>args</code></em> :</span></td>
<td> the list of arguments to insert in the output.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of characters which would be produced if the buffer
was large enough.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2987171"></a><h3>
<a name="g-vasprintf"></a>g_vasprintf ()</h3>
<a class="indexterm" name="id2987186"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_vasprintf (<a href="glib-Basic-Types.html#gchar">gchar</a> **string,
<a href="glib-Basic-Types.html#gchar">gchar</a> const *format,
va_list args);</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 href="glib-String-Utility-Functions.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> the return location for the newly-allocated string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td> a standard <code class="function">printf()</code> format string, but notice
<a href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>args</code></em> :</span></td>
<td> the list of arguments to insert in the output.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of characters printed.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2987340"></a><h3>
<a name="g-printf-string-upper-bound"></a>g_printf_string_upper_bound ()</h3>
<a class="indexterm" name="id2987354"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gsize">gsize</a> g_printf_string_upper_bound (const <a href="glib-Basic-Types.html#gchar">gchar</a> *format,
va_list args);</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>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td>the format string. See the <code class="function">printf()</code> documentation.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>args</code></em> :</span></td>
<td>the parameters to be inserted into the format string.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>the maximum space needed to store the formatted string.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2987455"></a><h3>
<a name="g-ascii-isalnum"></a>g_ascii_isalnum ()</h3>
<a class="indexterm" name="id2987468"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_isalnum (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Standard-Macros.html#FALSE:CAPS"><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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2987597"></a><h3>
<a name="g-ascii-isalpha"></a>g_ascii_isalpha ()</h3>
<a class="indexterm" name="id2987610"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_isalpha (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Standard-Macros.html#FALSE:CAPS"><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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2987737"></a><h3>
<a name="g-ascii-iscntrl"></a>g_ascii_iscntrl ()</h3>
<a class="indexterm" name="id2987750"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_iscntrl (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Standard-Macros.html#FALSE:CAPS"><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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2987878"></a><h3>
<a name="g-ascii-isdigit"></a>g_ascii_isdigit ()</h3>
<a class="indexterm" name="id2987891"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_isdigit (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2988006"></a><h3>
<a name="g-ascii-isgraph"></a>g_ascii_isgraph ()</h3>
<a class="indexterm" name="id2988019"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_isgraph (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Standard-Macros.html#FALSE:CAPS"><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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2988147"></a><h3>
<a name="g-ascii-islower"></a>g_ascii_islower ()</h3>
<a class="indexterm" name="id2988160"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_islower (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Standard-Macros.html#FALSE:CAPS"><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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2988288"></a><h3>
<a name="g-ascii-isprint"></a>g_ascii_isprint ()</h3>
<a class="indexterm" name="id2988300"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_isprint (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Standard-Macros.html#FALSE:CAPS"><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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2988428"></a><h3>
<a name="g-ascii-ispunct"></a>g_ascii_ispunct ()</h3>
<a class="indexterm" name="id2988441"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_ispunct (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Standard-Macros.html#FALSE:CAPS"><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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2988569"></a><h3>
<a name="g-ascii-isspace"></a>g_ascii_isspace ()</h3>
<a class="indexterm" name="id2988582"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_isspace (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Standard-Macros.html#FALSE:CAPS"><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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2988710"></a><h3>
<a name="g-ascii-isupper"></a>g_ascii_isupper ()</h3>
<a class="indexterm" name="id2988723"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_isupper (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Standard-Macros.html#FALSE:CAPS"><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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2988850"></a><h3>
<a name="g-ascii-isxdigit"></a>g_ascii_isxdigit ()</h3>
<a class="indexterm" name="id2988863"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_ascii_isxdigit (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Basic-Types.html#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>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td>any character
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><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" lang="en">
<a name="id2988979"></a><h3>
<a name="g-ascii-digit-value"></a>g_ascii_digit_value ()</h3>
<a class="indexterm" name="id2988992"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_ascii_digit_value (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</pre>
<p>
Determines the numeric value of a character as a decimal
digit. Differs from <a href="glib-Unicode-Manipulation.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td> an ASCII character.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> If <em class="parameter"><code>c</code></em> is a decimal digit (according to
<a href="glib-String-Utility-Functions.html#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" lang="en">
<a name="id2989084"></a><h3>
<a name="g-ascii-xdigit-value"></a>g_ascii_xdigit_value ()</h3>
<a class="indexterm" name="id2989098"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_ascii_xdigit_value (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</pre>
<p>
Determines the numeric value of a character as a hexidecimal
digit. Differs from <a href="glib-Unicode-Manipulation.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td> an ASCII character.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> If <em class="parameter"><code>c</code></em> is a hex digit (according to
<a href="glib-String-Utility-Functions.html#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" lang="en">
<a name="id2989190"></a><h3>
<a name="g-ascii-strcasecmp"></a>g_ascii_strcasecmp ()</h3>
<a class="indexterm" name="id2989204"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_ascii_strcasecmp (const <a href="glib-Basic-Types.html#gchar">gchar</a> *s1,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *s2);</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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>s1</code></em> :</span></td>
<td> string to compare with <em class="parameter"><code>s2</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>s2</code></em> :</span></td>
<td> string to compare with <em class="parameter"><code>s1</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2989350"></a><h3>
<a name="g-ascii-strncasecmp"></a>g_ascii_strncasecmp ()</h3>
<a class="indexterm" name="id2989363"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_ascii_strncasecmp (const <a href="glib-Basic-Types.html#gchar">gchar</a> *s1,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *s2,
<a href="glib-Basic-Types.html#gsize">gsize</a> n);</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 href="glib-String-Utility-Functions.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>s1</code></em> :</span></td>
<td> string to compare with <em class="parameter"><code>s2</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>s2</code></em> :</span></td>
<td> string to compare with <em class="parameter"><code>s1</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>n</code></em> :</span></td>
<td> number of characters to compare.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2989552"></a><h3>
<a name="g-ascii-strup"></a>g_ascii_strup ()</h3>
<a class="indexterm" name="id2989565"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_ascii_strup (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,
<a href="glib-Basic-Types.html#gssize">gssize</a> len);</pre>
<p>
Converts all lower case ASCII letters to upper case ASCII letters.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>str</code></em> :</span></td>
<td> a string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>len</code></em> :</span></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>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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 href="glib-String-Utility-Functions.html#g-ascii-toupper"><code class="function">g_ascii_toupper()</code></a>. (Note
that this is unlike the old <a href="glib-String-Utility-Functions.html#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" lang="en">
<a name="id2989689"></a><h3>
<a name="g-ascii-strdown"></a>g_ascii_strdown ()</h3>
<a class="indexterm" name="id2989702"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_ascii_strdown (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str,
<a href="glib-Basic-Types.html#gssize">gssize</a> len);</pre>
<p>
Converts all upper case ASCII letters to lower case ASCII letters.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>str</code></em> :</span></td>
<td> a string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>len</code></em> :</span></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>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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 href="glib-String-Utility-Functions.html#g-ascii-tolower"><code class="function">g_ascii_tolower()</code></a>. (Note
that this is unlike the old <a href="glib-String-Utility-Functions.html#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" lang="en">
<a name="id2989826"></a><h3>
<a name="g-ascii-tolower"></a>g_ascii_tolower ()</h3>
<a class="indexterm" name="id2989839"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a> g_ascii_tolower (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Basic-Types.html#guchar"><span class="type">guchar</span></a>
before passing a possibly non-ASCII character in.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td> any character.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2989958"></a><h3>
<a name="g-ascii-toupper"></a>g_ascii_toupper ()</h3>
<a class="indexterm" name="id2989971"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a> g_ascii_toupper (<a href="glib-Basic-Types.html#gchar">gchar</a> c);</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 href="glib-Basic-Types.html#guchar"><span class="type">guchar</span></a>
before passing a possibly non-ASCII character in.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>c</code></em> :</span></td>
<td> any character.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2990090"></a><h3>
<a name="g-string-ascii-up"></a>g_string_ascii_up ()</h3>
<a class="indexterm" name="id2990103"></a><pre class="programlisting"><a href="glib-Strings.html#GString">GString</a>* g_string_ascii_up (<a href="glib-Strings.html#GString">GString</a> *string);</pre>
<p>
Converts all lower case ASCII letters to upper case ASCII letters.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> a GString
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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 g_ascii_toupper.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990172"></a><h3>
<a name="g-string-ascii-down"></a>g_string_ascii_down ()</h3>
<a class="indexterm" name="id2990186"></a><pre class="programlisting"><a href="glib-Strings.html#GString">GString</a>* g_string_ascii_down (<a href="glib-Strings.html#GString">GString</a> *string);</pre>
<p>
Converts all upper case ASCII letters to lower case ASCII letters.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> a GString
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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 g_ascii_tolower.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990255"></a><h3>
<a name="g-strup"></a>g_strup ()</h3>
<a class="indexterm" name="id2990269"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strup (<a href="glib-Basic-Types.html#gchar">gchar</a> *string);</pre>
<div class="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 href="glib-String-Utility-Functions.html#g-strncasecmp"><code class="function">g_strncasecmp()</code></a> docs - use <a href="glib-String-Utility-Functions.html#g-ascii-strup"><code class="function">g_ascii_strup()</code></a> or <a href="glib-Unicode-Manipulation.html#g-utf8-strup"><code class="function">g_utf8_strup()</code></a> instead.</p>
</div>
<p>
Converts a string to upper case.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> the string to convert.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the string
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990378"></a><h3>
<a name="g-strdown"></a>g_strdown ()</h3>
<a class="indexterm" name="id2990392"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strdown (<a href="glib-Basic-Types.html#gchar">gchar</a> *string);</pre>
<div class="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 href="glib-String-Utility-Functions.html#g-strncasecmp"><code class="function">g_strncasecmp()</code></a> docs - use <a href="glib-String-Utility-Functions.html#g-ascii-strdown"><code class="function">g_ascii_strdown()</code></a> or <a href="glib-Unicode-Manipulation.html#g-utf8-strdown"><code class="function">g_utf8_strdown()</code></a>
instead.</p>
</div>
<p>
Converts a string to lower case.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> the string to convert.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the string
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990501"></a><h3>
<a name="g-strcasecmp"></a>g_strcasecmp ()</h3>
<a class="indexterm" name="id2990516"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_strcasecmp (const <a href="glib-Basic-Types.html#gchar">gchar</a> *s1,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *s2);</pre>
<div class="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 href="glib-String-Utility-Functions.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>s1</code></em> :</span></td>
<td> a string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>s2</code></em> :</span></td>
<td> a string to compare with <em class="parameter"><code>s1</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2990663"></a><h3>
<a name="g-strncasecmp"></a>g_strncasecmp ()</h3>
<a class="indexterm" name="id2990678"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_strncasecmp (const <a href="glib-Basic-Types.html#gchar">gchar</a> *s1,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *s2,
<a href="glib-Basic-Types.html#guint">guint</a> n);</pre>
<div class="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 href="glib-String-Utility-Functions.html#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 href="glib-String-Utility-Functions.html#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 href="glib-String-Utility-Functions.html#g-ascii-strncasecmp"><code class="function">g_ascii_strncasecmp()</code></a>,
which only works on ASCII and is not locale-sensitive, and
<a href="glib-Unicode-Manipulation.html#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 href="glib-String-Utility-Functions.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>s1</code></em> :</span></td>
<td> a string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>s2</code></em> :</span></td>
<td> a string to compare with <em class="parameter"><code>s1</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>n</code></em> :</span></td>
<td> the maximum number of characters to compare.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2990932"></a><h3>
<a name="g-strreverse"></a>g_strreverse ()</h3>
<a class="indexterm" name="id2990945"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strreverse (<a href="glib-Basic-Types.html#gchar">gchar</a> *string);</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 href="glib-String-Utility-Functions.html#g-strreverse"><code class="function">g_strreverse()</code></a> doesn't work on UTF-8 strings containing multibyte characters.
For that purpose, use <a href="glib-Unicode-Manipulation.html#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>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td>the string to reverse.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2991044"></a><h3>
<a name="g-ascii-strtoll"></a>g_ascii_strtoll ()</h3>
<a class="indexterm" name="id2991059"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint64">gint64</a> g_ascii_strtoll (const <a href="glib-Basic-Types.html#gchar">gchar</a> *nptr,
<a href="glib-Basic-Types.html#gchar">gchar</a> **endptr,
<a href="glib-Basic-Types.html#guint">guint</a> base);</pre>
<p>
Converts a string to a <a href="glib-Basic-Types.html#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 href="glib-Limits-of-Basic-Types.html#G-MAXINT64:CAPS"><code class="literal">G_MAXINT64</code></a> or <a href="glib-Limits-of-Basic-Types.html#G-MININT64:CAPS"><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 href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>nptr</code></em> :</span></td>
<td> the string to convert to a numeric value.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>endptr</code></em> :</span></td>
<td> if non-<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, it returns the character after
the last character used in the conversion.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>base</code></em> :</span></td>
<td> to be used for the conversion, 2..36 or 0
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the <a href="glib-Basic-Types.html#gint64"><span class="type">gint64</span></a> value or zero on error.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.12
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991326"></a><h3>
<a name="g-ascii-strtoull"></a>g_ascii_strtoull ()</h3>
<a class="indexterm" name="id2991341"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint64">guint64</a> g_ascii_strtoull (const <a href="glib-Basic-Types.html#gchar">gchar</a> *nptr,
<a href="glib-Basic-Types.html#gchar">gchar</a> **endptr,
<a href="glib-Basic-Types.html#guint">guint</a> base);</pre>
<p>
Converts a string to a <a href="glib-Basic-Types.html#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 href="glib-Limits-of-Basic-Types.html#G-MAXUINT64:CAPS"><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 href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>nptr</code></em> :</span></td>
<td> the string to convert to a numeric value.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>endptr</code></em> :</span></td>
<td> if non-<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, it returns the character after
the last character used in the conversion.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>base</code></em> :</span></td>
<td> to be used for the conversion, 2..36 or 0
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the <a href="glib-Basic-Types.html#guint64"><span class="type">guint64</span></a> value or zero on error.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991595"></a><h3>
<a name="G-ASCII-DTOSTR-BUF-SIZE:CAPS"></a>G_ASCII_DTOSTR_BUF_SIZE</h3>
<a class="indexterm" name="id2991609"></a><pre class="programlisting">#define G_ASCII_DTOSTR_BUF_SIZE (29 + 10)
</pre>
<p>
A good size for a buffer to be passed into <a href="glib-String-Utility-Functions.html#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"><pre class="programlisting">
char buf[G_ASCII_DTOSTR_BUF_SIZE];
fprintf (out, "value=%s\n", g_ascii_dtostr (buf, sizeof (buf), value));
</pre></div>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991652"></a><h3>
<a name="g-ascii-strtod"></a>g_ascii_strtod ()</h3>
<a class="indexterm" name="id2991665"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gdouble">gdouble</a> g_ascii_strtod (const <a href="glib-Basic-Types.html#gchar">gchar</a> *nptr,
<a href="glib-Basic-Types.html#gchar">gchar</a> **endptr);</pre>
<p>
Converts a string to a <a href="glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> value.
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.
</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 href="glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> to a string in a locale-insensitive
way, use <a href="glib-String-Utility-Functions.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>nptr</code></em> :</span></td>
<td> the string to convert to a numeric value.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>endptr</code></em> :</span></td>
<td> if non-<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, it returns the character after
the last character used in the conversion.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the <a href="glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> value.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991912"></a><h3>
<a name="g-ascii-dtostr"></a>g_ascii_dtostr ()</h3>
<a class="indexterm" name="id2991925"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_ascii_dtostr (<a href="glib-Basic-Types.html#gchar">gchar</a> *buffer,
<a href="glib-Basic-Types.html#gint">gint</a> buf_len,
<a href="glib-Basic-Types.html#gdouble">gdouble</a> d);</pre>
<p>
Converts a <a href="glib-Basic-Types.html#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 href="glib-String-Utility-Functions.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> A buffer to place the resulting string in
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buf_len</code></em> :</span></td>
<td> The length of the buffer.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>d</code></em> :</span></td>
<td> The <a href="glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> to convert
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The pointer to the buffer with the converted string.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992070"></a><h3>
<a name="g-ascii-formatd"></a>g_ascii_formatd ()</h3>
<a class="indexterm" name="id2992083"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_ascii_formatd (<a href="glib-Basic-Types.html#gchar">gchar</a> *buffer,
<a href="glib-Basic-Types.html#gint">gint</a> buf_len,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *format,
<a href="glib-Basic-Types.html#gdouble">gdouble</a> d);</pre>
<p>
Converts a <a href="glib-Basic-Types.html#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 href="glib-String-Utility-Functions.html#g-ascii-dtostr"><code class="function">g_ascii_dtostr()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> A buffer to place the resulting string in
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buf_len</code></em> :</span></td>
<td> The length of the buffer.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td> The <code class="function">printf()</code>-style format to use for the
code to use for converting.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>d</code></em> :</span></td>
<td> The <a href="glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> to convert
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The pointer to the buffer with the converted string.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992264"></a><h3>
<a name="g-strtod"></a>g_strtod ()</h3>
<a class="indexterm" name="id2992277"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gdouble">gdouble</a> g_strtod (const <a href="glib-Basic-Types.html#gchar">gchar</a> *nptr,
<a href="glib-Basic-Types.html#gchar">gchar</a> **endptr);</pre>
<p>
Converts a string to a <a href="glib-Basic-Types.html#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 href="glib-String-Utility-Functions.html#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 href="glib-String-Utility-Functions.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>nptr</code></em> :</span></td>
<td> the string to convert to a numeric value.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>endptr</code></em> :</span></td>
<td> if non-<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, it returns the character after
the last character used in the conversion.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the <a href="glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> value.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992431"></a><h3>
<a name="g-strchug"></a>g_strchug ()</h3>
<a class="indexterm" name="id2992444"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strchug (<a href="glib-Basic-Types.html#gchar">gchar</a> *string);</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 href="glib-String-Utility-Functions.html#g-strchomp"><code class="function">g_strchomp()</code></a> and <a href="glib-String-Utility-Functions.html#g-strstrip"><code class="function">g_strstrip()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td>a string to remove the leading whitespace from.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<em class="parameter"><code>string</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992548"></a><h3>
<a name="g-strchomp"></a>g_strchomp ()</h3>
<a class="indexterm" name="id2992561"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strchomp (<a href="glib-Basic-Types.html#gchar">gchar</a> *string);</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 href="glib-String-Utility-Functions.html#g-strchug"><code class="function">g_strchug()</code></a> and <a href="glib-String-Utility-Functions.html#g-strstrip"><code class="function">g_strstrip()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td>a string to remove the trailing whitespace from.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<em class="parameter"><code>string</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992665"></a><h3>
<a name="g-strstrip"></a>g_strstrip()</h3>
<a class="indexterm" name="id2992678"></a><pre class="programlisting">#define g_strstrip( string )</pre>
<p>
Removes leading and trailing whitespace from a string. See <a href="glib-String-Utility-Functions.html#g-strchomp"><code class="function">g_strchomp()</code></a> and
<a href="glib-String-Utility-Functions.html#g-strchug"><code class="function">g_strchug()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td>a string to remove the leading and trailing whitespace from.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992734"></a><h3>
<a name="g-strdelimit"></a>g_strdelimit ()</h3>
<a class="indexterm" name="id2992746"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strdelimit (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *delimiters,
<a href="glib-Basic-Types.html#gchar">gchar</a> new_delimiter);</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>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td>the string to convert.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>delimiters</code></em> :</span></td>
<td>a string containing the current delimiters, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to use the
standard delimiters defined in <a href="glib-String-Utility-Functions.html#G-STR-DELIMITERS:CAPS"><span class="type">G_STR_DELIMITERS</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>new_delimiter</code></em> :</span></td>
<td>the new delimiter character.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<em class="parameter"><code>string</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992924"></a><h3>
<a name="G-STR-DELIMITERS:CAPS"></a>G_STR_DELIMITERS</h3>
<a class="indexterm" name="id2992937"></a><pre class="programlisting">#define G_STR_DELIMITERS "_-|> <."
</pre>
<p>
The standard delimiters, used in <a href="glib-String-Utility-Functions.html#g-strdelimit"><code class="function">g_strdelimit()</code></a>.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992964"></a><h3>
<a name="g-strescape"></a>g_strescape ()</h3>
<a class="indexterm" name="id2992976"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strescape (const <a href="glib-Basic-Types.html#gchar">gchar</a> *source,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *exceptions);</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 href="glib-String-Utility-Functions.html#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>
<span class="term"><em class="parameter"><code>source</code></em> :</span></td>
<td>a string to escape.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>exceptions</code></em> :</span></td>
<td>a string of characters not to escape in <em class="parameter"><code>source</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2993101"></a><h3>
<a name="g-strcompress"></a>g_strcompress ()</h3>
<a class="indexterm" name="id2993114"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strcompress (const <a href="glib-Basic-Types.html#gchar">gchar</a> *source);</pre>
<p>
Replaces all escaped characters with their one byte equivalent. It
does the reverse conversion of <a href="glib-String-Utility-Functions.html#g-strescape"><code class="function">g_strescape()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>source</code></em> :</span></td>
<td>a string to compress.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2993189"></a><h3>
<a name="g-strcanon"></a>g_strcanon ()</h3>
<a class="indexterm" name="id2993202"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strcanon (<a href="glib-Basic-Types.html#gchar">gchar</a> *string,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *valid_chars,
<a href="glib-Basic-Types.html#gchar">gchar</a> substitutor);</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>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td>a nul-terminated array of bytes.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>valid_chars</code></em> :</span></td>
<td>bytes permitted in <em class="parameter"><code>string</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>substitutor</code></em> :</span></td>
<td>replacement character for disallowed bytes.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
<em class="parameter"><code>string</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2993352"></a><h3>
<a name="g-strsplit"></a>g_strsplit ()</h3>
<a class="indexterm" name="id2993365"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>** g_strsplit (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *delimiter,
<a href="glib-Basic-Types.html#gint">gint</a> max_tokens);</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 href="glib-String-Utility-Functions.html#g-strsplit"><code class="function">g_strsplit()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> a string to split.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>delimiter</code></em> :</span></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>
<span class="term"><em class="parameter"><code>max_tokens</code></em> :</span></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>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a newly-allocated <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings. Use
<a href="glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a> to free it.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2993551"></a><h3>
<a name="g-strsplit-set"></a>g_strsplit_set ()</h3>
<a class="indexterm" name="id2993566"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>** g_strsplit_set (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string,
const <a href="glib-Basic-Types.html#gchar">gchar</a> *delimiters,
<a href="glib-Basic-Types.html#gint">gint</a> max_tokens);</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 href="glib-Standard-Macros.html#NULL:CAPS"><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 href="glib-Standard-Macros.html#NULL:CAPS"><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 href="glib-String-Utility-Functions.html#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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string</code></em> :</span></td>
<td> The string to be tokenized
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>delimiters</code></em> :</span></td>
<td> A nul-terminated string containing bytes that are used
to split the string.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>max_tokens</code></em> :</span></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>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a newly-allocated <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings. Use
<a href="glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a> to free it.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2993789"></a><h3>
<a name="g-strfreev"></a>g_strfreev ()</h3>
<a class="indexterm" name="id2993802"></a><pre class="programlisting">void g_strfreev (<a href="glib-Basic-Types.html#gchar">gchar</a> **str_array);</pre>
<p>
Frees a <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings, and the array itself.
If called on a <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> value, <a href="glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a> simply returns.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>str_array</code></em> :</span></td>
<td> a <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings to free.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2993894"></a><h3>
<a name="g-strconcat"></a>g_strconcat ()</h3>
<a class="indexterm" name="id2993907"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strconcat (const <a href="glib-Basic-Types.html#gchar">gchar</a> *string1,
...);</pre>
<p>
Concatenates all of the given strings into one long string. The returned string
should be freed when no longer needed.
</p>
<div class="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 href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
If you forget the <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, <a href="glib-String-Utility-Functions.html#g-strconcat"><code class="function">g_strconcat()</code></a> will start appending
random memory junk to your string.
</p>
</div>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>string1</code></em> :</span></td>
<td>The first string to add, which must not be <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td>a <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated list of strings to append to the string.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>a newly-allocated string containing all the string arguments.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2994042"></a><h3>
<a name="g-strjoin"></a>g_strjoin ()</h3>
<a class="indexterm" name="id2994055"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strjoin (const <a href="glib-Basic-Types.html#gchar">gchar</a> *separator,
...);</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.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>separator</code></em> :</span></td>
<td>a string to insert between each of the strings, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td>a <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated list of strings to join.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2994162"></a><h3>
<a name="g-strjoinv"></a>g_strjoinv ()</h3>
<a class="indexterm" name="id2994175"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>* g_strjoinv (const <a href="glib-Basic-Types.html#gchar">gchar</a> *separator,
<a href="glib-Basic-Types.html#gchar">gchar</a> **str_array);</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.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>separator</code></em> :</span></td>
<td>a string to insert between each of the strings, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>str_array</code></em> :</span></td>
<td>a <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings to join.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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" lang="en">
<a name="id2994290"></a><h3>
<a name="g-strv-length"></a>g_strv_length ()</h3>
<a class="indexterm" name="id2994305"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a> g_strv_length (<a href="glib-Basic-Types.html#gchar">gchar</a> **str_array);</pre>
<p>
Returns the length of the given <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated
string array <em class="parameter"><code>str_array</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>str_array</code></em> :</span></td>
<td> a <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> length of <em class="parameter"><code>str_array</code></em>.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2994402"></a><h3>
<a name="g-strerror"></a>g_strerror ()</h3>
<a class="indexterm" name="id2994414"></a><pre class="programlisting">const <a href="glib-Basic-Types.html#gchar">gchar</a>* g_strerror (<a href="glib-Basic-Types.html#gint">gint</a> errnum);</pre>
<p>
Returns a string corresponding to the given error code, e.g. "no such process".
This function is included 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>
<span class="term"><em class="parameter"><code>errnum</code></em> :</span></td>
<td>the system error number. See the standard C <code class="literal">errno</code>
documentation.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>a 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 href="glib-String-Utility-Functions.html#g-strerror"><code class="function">g_strerror()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2994511"></a><h3>
<a name="g-strsignal"></a>g_strsignal ()</h3>
<a class="indexterm" name="id2994523"></a><pre class="programlisting">const <a href="glib-Basic-Types.html#gchar">gchar</a>* g_strsignal (<a href="glib-Basic-Types.html#gint">gint</a> signum);</pre>
<p>
Returns a string describing the given signal, e.g. "Segmentation fault".
This function is included 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>
<span class="term"><em class="parameter"><code>signum</code></em> :</span></td>
<td>the signal number. See the <code class="literal">signal</code>
documentation.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>a 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 href="glib-String-Utility-Functions.html#g-strsignal"><code class="function">g_strsignal()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>