blob: c032de240e8bb3bf69bd14750f8c1b3a616947e4 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>String Utility Functions: GLib Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
<link rel="prev" href="glib-utilities.html" title="GLib Utilities">
<link rel="next" href="glib-Character-Set-Conversion.html" title="Character Set Conversion">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
<a href="#glib-String-Utility-Functions.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="glib-utilities.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="glib-Character-Set-Conversion.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="glib-String-Utility-Functions"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-String-Utility-Functions.top_of_page"></a>String Utility Functions</span></h2>
<p>String Utility Functions — various string-related functions</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="glib-String-Utility-Functions.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strdup" title="g_strdup ()">g_strdup</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strndup" title="g_strndup ()">g_strndup</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strdupv" title="g_strdupv ()">g_strdupv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strnfill" title="g_strnfill ()">g_strnfill</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-stpcpy" title="g_stpcpy ()">g_stpcpy</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strstr-len" title="g_strstr_len ()">g_strstr_len</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strrstr" title="g_strrstr ()">g_strrstr</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strrstr-len" title="g_strrstr_len ()">g_strrstr_len</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-str-has-prefix" title="g_str_has_prefix ()">g_str_has_prefix</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-str-has-suffix" title="g_str_has_suffix ()">g_str_has_suffix</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strcmp0" title="g_strcmp0 ()">g_strcmp0</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-str-to-ascii" title="g_str_to_ascii ()">g_str_to_ascii</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-str-tokenize-and-fold" title="g_str_tokenize_and_fold ()">g_str_tokenize_and_fold</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-str-match-string" title="g_str_match_string ()">g_str_match_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strlcpy" title="g_strlcpy ()">g_strlcpy</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strlcat" title="g_strlcat ()">g_strlcat</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strdup-printf" title="g_strdup_printf ()">g_strdup_printf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strdup-vprintf" title="g_strdup_vprintf ()">g_strdup_vprintf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-printf" title="g_printf ()">g_printf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-vprintf" title="g_vprintf ()">g_vprintf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-fprintf" title="g_fprintf ()">g_fprintf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-vfprintf" title="g_vfprintf ()">g_vfprintf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-sprintf" title="g_sprintf ()">g_sprintf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-vsprintf" title="g_vsprintf ()">g_vsprintf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-snprintf" title="g_snprintf ()">g_snprintf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-vsnprintf" title="g_vsnprintf ()">g_vsnprintf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-vasprintf" title="g_vasprintf ()">g_vasprintf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-printf-string-upper-bound" title="g_printf_string_upper_bound ()">g_printf_string_upper_bound</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-str-is-ascii" title="g_str_is_ascii ()">g_str_is_ascii</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-isalnum" title="g_ascii_isalnum ()">g_ascii_isalnum</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-isalpha" title="g_ascii_isalpha ()">g_ascii_isalpha</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-iscntrl" title="g_ascii_iscntrl ()">g_ascii_iscntrl</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-isdigit" title="g_ascii_isdigit ()">g_ascii_isdigit</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-isgraph" title="g_ascii_isgraph ()">g_ascii_isgraph</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-islower" title="g_ascii_islower ()">g_ascii_islower</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-isprint" title="g_ascii_isprint ()">g_ascii_isprint</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-ispunct" title="g_ascii_ispunct ()">g_ascii_ispunct</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-isspace" title="g_ascii_isspace ()">g_ascii_isspace</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-isupper" title="g_ascii_isupper ()">g_ascii_isupper</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-isxdigit" title="g_ascii_isxdigit ()">g_ascii_isxdigit</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-digit-value" title="g_ascii_digit_value ()">g_ascii_digit_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-xdigit-value" title="g_ascii_xdigit_value ()">g_ascii_xdigit_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-strcasecmp" title="g_ascii_strcasecmp ()">g_ascii_strcasecmp</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-strncasecmp" title="g_ascii_strncasecmp ()">g_ascii_strncasecmp</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-strup" title="g_ascii_strup ()">g_ascii_strup</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-strdown" title="g_ascii_strdown ()">g_ascii_strdown</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-tolower" title="g_ascii_tolower ()">g_ascii_tolower</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-toupper" title="g_ascii_toupper ()">g_ascii_toupper</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="returnvalue">GString</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-string-ascii-up" title="g_string_ascii_up ()">g_string_ascii_up</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="returnvalue">GString</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-string-ascii-down" title="g_string_ascii_down ()">g_string_ascii_down</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strup" title="g_strup ()">g_strup</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strdown" title="g_strdown ()">g_strdown</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strcasecmp" title="g_strcasecmp ()">g_strcasecmp</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strncasecmp" title="g_strncasecmp ()">g_strncasecmp</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strreverse" title="g_strreverse ()">g_strreverse</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="returnvalue">gint64</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-strtoll" title="g_ascii_strtoll ()">g_ascii_strtoll</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="returnvalue">guint64</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-strtoull" title="g_ascii_strtoull ()">g_ascii_strtoull</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="returnvalue">gdouble</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-strtod" title="g_ascii_strtod ()">g_ascii_strtod</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-dtostr" title="g_ascii_dtostr ()">g_ascii_dtostr</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-ascii-formatd" title="g_ascii_formatd ()">g_ascii_formatd</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="returnvalue">gdouble</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strtod" title="g_strtod ()">g_strtod</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strchug" title="g_strchug ()">g_strchug</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strchomp" title="g_strchomp ()">g_strchomp</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strstrip" title="g_strstrip()">g_strstrip</a><span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strdelimit" title="g_strdelimit ()">g_strdelimit</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strescape" title="g_strescape ()">g_strescape</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strcompress" title="g_strcompress ()">g_strcompress</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strcanon" title="g_strcanon ()">g_strcanon</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strsplit" title="g_strsplit ()">g_strsplit</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strsplit-set" title="g_strsplit_set ()">g_strsplit_set</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()">g_strfreev</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strconcat" title="g_strconcat ()">g_strconcat</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strjoin" title="g_strjoin ()">g_strjoin</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strjoinv" title="g_strjoinv ()">g_strjoinv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strv-length" title="g_strv_length ()">g_strv_length</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strv-contains" title="g_strv_contains ()">g_strv_contains</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strerror" title="g_strerror ()">g_strerror</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-String-Utility-Functions.html#g-strsignal" title="g_strsignal ()">g_strsignal</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="glib-String-Utility-Functions.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-String-Utility-Functions.html#G-ASCII-DTOSTR-BUF-SIZE:CAPS" title="G_ASCII_DTOSTR_BUF_SIZE">G_ASCII_DTOSTR_BUF_SIZE</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-String-Utility-Functions.html#G-STR-DELIMITERS:CAPS" title="G_STR_DELIMITERS">G_STR_DELIMITERS</a></td>
</tr>
<tr>
<td class="typedef_keyword">typedef</td>
<td class="function_name"><a class="link" href="glib-String-Utility-Functions.html#GStrv" title="GStrv">GStrv</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="glib-String-Utility-Functions.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;glib.h&gt;
#include &lt;glib/gprintf.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="glib-String-Utility-Functions.description"></a><h2>Description</h2>
<p>This section describes a number of utility functions for creating,
duplicating, and manipulating strings.</p>
<p>Note that the functions <a class="link" href="glib-String-Utility-Functions.html#g-printf" title="g_printf ()"><code class="function">g_printf()</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-fprintf" title="g_fprintf ()"><code class="function">g_fprintf()</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-sprintf" title="g_sprintf ()"><code class="function">g_sprintf()</code></a>,
<a class="link" href="glib-String-Utility-Functions.html#g-snprintf" title="g_snprintf ()"><code class="function">g_snprintf()</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-vprintf" title="g_vprintf ()"><code class="function">g_vprintf()</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-vfprintf" title="g_vfprintf ()"><code class="function">g_vfprintf()</code></a>, <a class="link" href="glib-String-Utility-Functions.html#g-vsprintf" title="g_vsprintf ()"><code class="function">g_vsprintf()</code></a> and <a class="link" href="glib-String-Utility-Functions.html#g-vsnprintf" title="g_vsnprintf ()"><code class="function">g_vsnprintf()</code></a>
are declared in the header <code class="literal">gprintf.h</code> which is not included in <code class="literal">glib.h</code>
(otherwise using <code class="literal">glib.h</code> would drag in <code class="literal">stdio.h</code>), so you'll have to
explicitly include <code class="literal">&lt;glib/gprintf.h&gt;</code> in order to use the GLib
<code class="function">printf()</code> functions.</p>
<div class="refsect3">
<a name="string-precision"></a><h4>String precision pitfalls</h4>
<p>While you may use the <code class="function">printf()</code> functions to format UTF-8 strings,
notice that the precision of a %Ns parameter is interpreted
as the number of bytes, not characters 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 %Ns
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 %Ns. If your intention is to format strings for a
certain number of columns, then %Ns is not a correct solution
anyway, since it fails to take wide characters (see <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iswide" title="g_unichar_iswide ()"><code class="function">g_unichar_iswide()</code></a>)
into account.</p>
<p>Note also that there are various <code class="function">printf()</code> parameters which are platform
dependent. GLib provides platform independent macros for these parameters
which should be used instead. A common example is <a class="link" href="glib-Basic-Types.html#G-GUINT64-FORMAT:CAPS" title="G_GUINT64_FORMAT"><code class="literal">G_GUINT64_FORMAT</code></a>, which
should be used instead of <code class="literal">%llu</code> or similar parameters for formatting
64-bit integers. These macros are all named <code class="literal">G_*_FORMAT</code>; see
<a class="link" href="glib-Basic-Types.html" title="Basic Types">Basic Types</a>.</p>
</div>
</div>
<div class="refsect1">
<a name="glib-String-Utility-Functions.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="g-strdup"></a><h3>g_strdup ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_strdup (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>);</pre>
<p>Duplicates a string. If <em class="parameter"><code>str</code></em>
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> it returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
The returned string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>
when no longer needed.</p>
<div class="refsect3">
<a name="g-strdup.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>str</p></td>
<td class="parameter_description"><p> the string to duplicate. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strdup.returns"></a><h4>Returns</h4>
<p> a newly-allocated copy of <em class="parameter"><code>str</code></em>
</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-strndup"></a><h3>g_strndup ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_strndup (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n</code></em>);</pre>
<p>Duplicates the first <em class="parameter"><code>n</code></em>
bytes of a string, returning a newly-allocated
buffer <em class="parameter"><code>n</code></em>
+ 1 bytes long which will always be nul-terminated. If <em class="parameter"><code>str</code></em>
is less than <em class="parameter"><code>n</code></em>
bytes long the buffer is padded with nuls. If <em class="parameter"><code>str</code></em>
is
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> it returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. The returned value should be freed when no longer
needed.</p>
<p>To copy a number of characters from a UTF-8 encoded string,
use <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strncpy" title="g_utf8_strncpy ()"><code class="function">g_utf8_strncpy()</code></a> instead.</p>
<div class="refsect3">
<a name="g-strndup.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>str</p></td>
<td class="parameter_description"><p>the string to duplicate</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>the maximum number of bytes to copy from <em class="parameter"><code>str</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strndup.returns"></a><h4>Returns</h4>
<p> a newly-allocated buffer containing the first <em class="parameter"><code>n</code></em>
bytes
of <em class="parameter"><code>str</code></em>
, nul-terminated</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-strdupv"></a><h3>g_strdupv ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_strdupv (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **str_array</code></em>);</pre>
<p>Copies <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings. The copy is a deep copy;
the new array should be freed by first freeing each string, then
the array itself. <a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a> does this for you. If called
on a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> value, <a class="link" href="glib-String-Utility-Functions.html#g-strdupv" title="g_strdupv ()"><code class="function">g_strdupv()</code></a> simply returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
<div class="refsect3">
<a name="g-strdupv.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>str_array</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strdupv.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings. </p>
<p><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-strnfill"></a><h3>g_strnfill ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_strnfill (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> length</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> fill_char</code></em>);</pre>
<p>Creates a new string <em class="parameter"><code>length</code></em>
bytes long filled with <em class="parameter"><code>fill_char</code></em>
.
The returned string should be freed when no longer needed.</p>
<div class="refsect3">
<a name="g-strnfill.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p>the length of the new string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>fill_char</p></td>
<td class="parameter_description"><p>the byte to fill the string with</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strnfill.returns"></a><h4>Returns</h4>
<p> a newly-allocated string filled the <em class="parameter"><code>fill_char</code></em>
</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-stpcpy"></a><h3>g_stpcpy ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_stpcpy (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dest</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *src</code></em>);</pre>
<p>Copies a nul-terminated string into the dest buffer, include the
trailing nul, and return a pointer to the trailing nul byte.
This is useful for concatenating multiple strings together
without having to repeatedly scan for the end.</p>
<div class="refsect3">
<a name="g-stpcpy.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dest</p></td>
<td class="parameter_description"><p>destination buffer.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src</p></td>
<td class="parameter_description"><p>source string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-stpcpy.returns"></a><h4>Returns</h4>
<p> a pointer to trailing nul byte.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-strstr-len"></a><h3>g_strstr_len ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_strstr_len (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *haystack</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> haystack_len</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *needle</code></em>);</pre>
<p>Searches the string <em class="parameter"><code>haystack</code></em>
for the first occurrence
of the string <em class="parameter"><code>needle</code></em>
, limiting the length of the search
to <em class="parameter"><code>haystack_len</code></em>
.</p>
<div class="refsect3">
<a name="g-strstr-len.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>haystack</p></td>
<td class="parameter_description"><p>a string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>haystack_len</p></td>
<td class="parameter_description"><p>the maximum length of <em class="parameter"><code>haystack</code></em>
. Note that -1 is
a valid length, if <em class="parameter"><code>haystack</code></em>
is nul-terminated, meaning it will
search through the whole string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>needle</p></td>
<td class="parameter_description"><p>the string to search for</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strstr-len.returns"></a><h4>Returns</h4>
<p> a pointer to the found occurrence, or
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if not found.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-strrstr"></a><h3>g_strrstr ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_strrstr (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *haystack</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *needle</code></em>);</pre>
<p>Searches the string <em class="parameter"><code>haystack</code></em>
for the last occurrence
of the string <em class="parameter"><code>needle</code></em>
.</p>
<div class="refsect3">
<a name="g-strrstr.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>haystack</p></td>
<td class="parameter_description"><p>a nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>needle</p></td>
<td class="parameter_description"><p>the nul-terminated string to search for</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strrstr.returns"></a><h4>Returns</h4>
<p> a pointer to the found occurrence, or
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if not found.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-strrstr-len"></a><h3>g_strrstr_len ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_strrstr_len (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *haystack</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> haystack_len</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *needle</code></em>);</pre>
<p>Searches the string <em class="parameter"><code>haystack</code></em>
for the last occurrence
of the string <em class="parameter"><code>needle</code></em>
, limiting the length of the search
to <em class="parameter"><code>haystack_len</code></em>
.</p>
<div class="refsect3">
<a name="g-strrstr-len.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>haystack</p></td>
<td class="parameter_description"><p>a nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>haystack_len</p></td>
<td class="parameter_description"><p>the maximum length of <em class="parameter"><code>haystack</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>needle</p></td>
<td class="parameter_description"><p>the nul-terminated string to search for</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strrstr-len.returns"></a><h4>Returns</h4>
<p> a pointer to the found occurrence, or
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if not found.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-str-has-prefix"></a><h3>g_str_has_prefix ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_str_has_prefix (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prefix</code></em>);</pre>
<p>Looks whether the string <em class="parameter"><code>str</code></em>
begins with <em class="parameter"><code>prefix</code></em>
.</p>
<div class="refsect3">
<a name="g-str-has-prefix.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>str</p></td>
<td class="parameter_description"><p>a nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>prefix</p></td>
<td class="parameter_description"><p>the nul-terminated prefix to look for</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-str-has-prefix.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>str</code></em>
begins with <em class="parameter"><code>prefix</code></em>
, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-2.html#api-index-2.2">2.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-str-has-suffix"></a><h3>g_str_has_suffix ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_str_has_suffix (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *suffix</code></em>);</pre>
<p>Looks whether the string <em class="parameter"><code>str</code></em>
ends with <em class="parameter"><code>suffix</code></em>
.</p>
<div class="refsect3">
<a name="g-str-has-suffix.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>str</p></td>
<td class="parameter_description"><p>a nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>suffix</p></td>
<td class="parameter_description"><p>the nul-terminated suffix to look for</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-str-has-suffix.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>str</code></em>
end with <em class="parameter"><code>suffix</code></em>
, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-2.html#api-index-2.2">2.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-strcmp0"></a><h3>g_strcmp0 ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
g_strcmp0 (<em class="parameter"><code>const <span class="type">char</span> *str1</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *str2</code></em>);</pre>
<p>Compares <em class="parameter"><code>str1</code></em>
and <em class="parameter"><code>str2</code></em>
like <code class="function">strcmp()</code>. Handles <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
gracefully by sorting it before non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> strings.
Comparing two <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> pointers returns 0.</p>
<div class="refsect3">
<a name="g-strcmp0.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>str1</p></td>
<td class="parameter_description"><p> a C string or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>str2</p></td>
<td class="parameter_description"><p> another C string or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strcmp0.returns"></a><h4>Returns</h4>
<p> an integer less than, equal to, or greater than zero, if <em class="parameter"><code>str1</code></em>
is &lt;, == or &gt; than <em class="parameter"><code>str2</code></em>
.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-16.html#api-index-2.16">2.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-str-to-ascii"></a><h3>g_str_to_ascii ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_str_to_ascii (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *from_locale</code></em>);</pre>
<p>Transliterate <em class="parameter"><code>str</code></em>
to plain ASCII.</p>
<p>For best results, <em class="parameter"><code>str</code></em>
should be in composed normalised form.</p>
<p>This function performs a reasonably good set of character
replacements. The particular set of replacements that is done may
change by version or even by runtime environment.</p>
<p>If the source language of <em class="parameter"><code>str</code></em>
is known, it can used to improve the
accuracy of the translation by passing it as <em class="parameter"><code>from_locale</code></em>
. It should
be a valid POSIX locale string (of the form
"language_territory[<em class="parameter"><code>modifier</code></em>
]").</p>
<p>If <em class="parameter"><code>from_locale</code></em>
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then the current locale is used.</p>
<p>If you want to do translation for no specific locale, and you want it
to be done independently of the currently locale, specify "C" for
<em class="parameter"><code>from_locale</code></em>
.</p>
<div class="refsect3">
<a name="g-str-to-ascii.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>str</p></td>
<td class="parameter_description"><p>a string, in UTF-8</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>from_locale</p></td>
<td class="parameter_description"><p> the source locale, if known. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-str-to-ascii.returns"></a><h4>Returns</h4>
<p> a string in plain ASCII</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-str-tokenize-and-fold"></a><h3>g_str_tokenize_and_fold ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_str_tokenize_and_fold (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *translit_locale</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> ***ascii_alternates</code></em>);</pre>
<p>Tokenises <em class="parameter"><code>string</code></em>
and performs folding on each token.</p>
<p>A token is a non-empty sequence of alphanumeric characters in the
source string, separated by non-alphanumeric characters. An
"alphanumeric" character for this purpose is one that matches
<a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isalnum" title="g_unichar_isalnum ()"><code class="function">g_unichar_isalnum()</code></a> or <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-ismark" title="g_unichar_ismark ()"><code class="function">g_unichar_ismark()</code></a>.</p>
<p>Each token is then (Unicode) normalised and case-folded. If
<em class="parameter"><code>ascii_alternates</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> and some of the returned tokens
contain non-ASCII characters, ASCII alternatives will be generated.</p>
<p>The number of ASCII alternatives that are generated and the method
for doing so is unspecified, but <em class="parameter"><code>translit_locale</code></em>
(if specified) may
improve the transliteration if the language of the source string is
known.</p>
<div class="refsect3">
<a name="g-str-tokenize-and-fold.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>a string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>translit_locale</p></td>
<td class="parameter_description"><p> the language code (like 'de' or
'en_GB') from which <em class="parameter"><code>string</code></em>
originates. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>ascii_alternates</p></td>
<td class="parameter_description"><p> a
return location for ASCII alternates. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-str-tokenize-and-fold.returns"></a><h4>Returns</h4>
<p> the folded tokens. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-str-match-string"></a><h3>g_str_match_string ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_str_match_string (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *search_term</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *potential_hit</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> accept_alternates</code></em>);</pre>
<p>Checks if a search conducted for <em class="parameter"><code>search_term</code></em>
should match
<em class="parameter"><code>potential_hit</code></em>
.</p>
<p>This function calls <a class="link" href="glib-String-Utility-Functions.html#g-str-tokenize-and-fold" title="g_str_tokenize_and_fold ()"><code class="function">g_str_tokenize_and_fold()</code></a> on both
<em class="parameter"><code>search_term</code></em>
and <em class="parameter"><code>potential_hit</code></em>
. ASCII alternates are never taken
for <em class="parameter"><code>search_term</code></em>
but will be taken for <em class="parameter"><code>potential_hit</code></em>
according to
the value of <em class="parameter"><code>accept_alternates</code></em>
.</p>
<p>A hit occurs when each folded token in <em class="parameter"><code>search_term</code></em>
is a prefix of a
folded token from <em class="parameter"><code>potential_hit</code></em>
.</p>
<p>Depending on how you're performing the search, it will typically be
faster to call <a class="link" href="glib-String-Utility-Functions.html#g-str-tokenize-and-fold" title="g_str_tokenize_and_fold ()"><code class="function">g_str_tokenize_and_fold()</code></a> on each string in
your corpus and build an index on the returned folded tokens, then
call <a class="link" href="glib-String-Utility-Functions.html#g-str-tokenize-and-fold" title="g_str_tokenize_and_fold ()"><code class="function">g_str_tokenize_and_fold()</code></a> on the search term and
perform lookups into that index.</p>
<p>As some examples, searching for "fred" would match the potential hit
"Smith, Fred" and also "Frédéric". Searching for "Fréd" would match
"Frédéric" but not "Frederic" (due to the one-directional nature of
accent matching). Searching "fo" would match "Foo" and "Bar Foo
Baz", but not "SFO" (because no word as "fo" as a prefix).</p>
<div class="refsect3">
<a name="g-str-match-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>search_term</p></td>
<td class="parameter_description"><p>the search term from the user</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>potential_hit</p></td>
<td class="parameter_description"><p>the text that may be a hit</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>accept_alternates</p></td>
<td class="parameter_description"><p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> to accept ASCII alternates</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-str-match-string.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>potential_hit</code></em>
is a hit</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-strlcpy"></a><h3>g_strlcpy ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
g_strlcpy (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dest</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *src</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> dest_size</code></em>);</pre>
<p>Portability wrapper that calls <code class="function">strlcpy()</code> on systems which have it,
and emulates <code class="function">strlcpy()</code> otherwise. Copies <em class="parameter"><code>src</code></em>
to <em class="parameter"><code>dest</code></em>
; <em class="parameter"><code>dest</code></em>
is
guaranteed to be nul-terminated; <em class="parameter"><code>src</code></em>
must be nul-terminated;
<em class="parameter"><code>dest_size</code></em>
is the buffer size, not the number of bytes to copy.</p>
<p>At most <em class="parameter"><code>dest_size</code></em>
- 1 characters will be copied. Always nul-terminates
(unless <em class="parameter"><code>dest_size</code></em>
is 0). This function does not allocate memory. Unlike
<code class="function">strncpy()</code>, this function doesn't pad <em class="parameter"><code>dest</code></em>
(so it's often faster). It
returns the size of the attempted result, strlen (src), so if
<em class="parameter"><code>retval</code></em>
&gt;= <em class="parameter"><code>dest_size</code></em>
, truncation occurred.</p>
<p>Caveat: <code class="function">strlcpy()</code> is supposedly more secure than <code class="function">strcpy()</code> or <code class="function">strncpy()</code>,
but if you really want to avoid screwups, <a class="link" href="glib-String-Utility-Functions.html#g-strdup" title="g_strdup ()"><code class="function">g_strdup()</code></a> is an even better
idea.</p>
<div class="refsect3">
<a name="g-strlcpy.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dest</p></td>
<td class="parameter_description"><p>destination buffer</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src</p></td>
<td class="parameter_description"><p>source buffer</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest_size</p></td>
<td class="parameter_description"><p>length of <em class="parameter"><code>dest</code></em>
in bytes</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strlcpy.returns"></a><h4>Returns</h4>
<p> length of <em class="parameter"><code>src</code></em>
</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-strlcat"></a><h3>g_strlcat ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
g_strlcat (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dest</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *src</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> dest_size</code></em>);</pre>
<p>Portability wrapper that calls <code class="function">strlcat()</code> on systems which have it,
and emulates it otherwise. Appends nul-terminated <em class="parameter"><code>src</code></em>
string to <em class="parameter"><code>dest</code></em>
,
guaranteeing nul-termination for <em class="parameter"><code>dest</code></em>
. The total size of <em class="parameter"><code>dest</code></em>
won't
exceed <em class="parameter"><code>dest_size</code></em>
.</p>
<p>At most <em class="parameter"><code>dest_size</code></em>
- 1 characters will be copied. Unlike <code class="function">strncat()</code>,
<em class="parameter"><code>dest_size</code></em>
is the full size of dest, not the space left over. This
function does not allocate memory. It always nul-terminates (unless
<em class="parameter"><code>dest_size</code></em>
== 0 or there were no nul characters in the <em class="parameter"><code>dest_size</code></em>
characters of dest to start with).</p>
<p>Caveat: this is supposedly a more secure alternative to <code class="function">strcat()</code> or
<code class="function">strncat()</code>, but for real security <a class="link" href="glib-String-Utility-Functions.html#g-strconcat" title="g_strconcat ()"><code class="function">g_strconcat()</code></a> is harder to mess up.</p>
<div class="refsect3">
<a name="g-strlcat.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dest</p></td>
<td class="parameter_description"><p>destination buffer, already containing one nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src</p></td>
<td class="parameter_description"><p>source buffer</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest_size</p></td>
<td class="parameter_description"><p>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>
)</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strlcat.returns"></a><h4>Returns</h4>
<p> size of attempted result, which is MIN (dest_size, strlen
(original dest)) + strlen (src), so if retval &gt;= dest_size,
truncation occurred.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-strdup-printf"></a><h3>g_strdup_printf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_strdup_printf (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Similar to the standard C <code class="function">sprintf()</code> function but safer, since it
calculates the maximum space required and allocates memory to hold
the result. The returned string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when no
longer needed.</p>
<div class="refsect3">
<a name="g-strdup-printf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
<a class="link" href="glib-String-Utility-Functions.html#string-precision" title="String precision pitfalls">string precision pitfalls</a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>the parameters to insert into the format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strdup-printf.returns"></a><h4>Returns</h4>
<p> a newly-allocated string holding the result</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-strdup-vprintf"></a><h3>g_strdup_vprintf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_strdup_vprintf (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
<em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre>
<p>Similar to the standard C <code class="function">vsprintf()</code> function but safer, since it
calculates the maximum space required and allocates memory to hold
the result. The returned string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when
no longer needed.</p>
<p>See also <a class="link" href="glib-String-Utility-Functions.html#g-vasprintf" title="g_vasprintf ()"><code class="function">g_vasprintf()</code></a>, which offers the same functionality, but
additionally returns the length of the allocated string.</p>
<div class="refsect3">
<a name="g-strdup-vprintf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
<a class="link" href="glib-String-Utility-Functions.html#string-precision" title="String precision pitfalls">string precision pitfalls</a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>args</p></td>
<td class="parameter_description"><p>the list of parameters to insert into the format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-strdup-vprintf.returns"></a><h4>Returns</h4>
<p> a newly-allocated string holding the result</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-printf"></a><h3>g_printf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_printf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>An implementation of the standard <code class="function">printf()</code> function which supports
positional parameters, as specified in the Single Unix Specification.</p>
<p>As with the standard <code class="function">printf()</code>, this does not automatically append a trailing
new-line character to the message, so typically <em class="parameter"><code>format</code></em>
should end with its
own new-line character.</p>
<div class="refsect3">
<a name="g-printf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
<a class="link" href="glib-String-Utility-Functions.html#string-precision" title="String precision pitfalls">string precision pitfalls</a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>the arguments to insert in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-printf.returns"></a><h4>Returns</h4>
<p> the number of bytes printed.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-2.html#api-index-2.2">2.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-vprintf"></a><h3>g_vprintf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_vprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>,
<em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre>
<p>An implementation of the standard <code class="function">vprintf()</code> function which supports
positional parameters, as specified in the Single Unix Specification.</p>
<div class="refsect3">
<a name="g-vprintf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
<a class="link" href="glib-String-Utility-Functions.html#string-precision" title="String precision pitfalls">string precision pitfalls</a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>args</p></td>
<td class="parameter_description"><p>the list of arguments to insert in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-vprintf.returns"></a><h4>Returns</h4>
<p> the number of bytes printed.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-2.html#api-index-2.2">2.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-fprintf"></a><h3>g_fprintf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_fprintf (<em class="parameter"><code><span class="type">FILE</span> *file</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>An implementation of the standard <code class="function">fprintf()</code> function which supports
positional parameters, as specified in the Single Unix Specification.</p>
<div class="refsect3">
<a name="g-fprintf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>file</p></td>
<td class="parameter_description"><p> the stream to write to. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL must not be passed as the value in, out, in-out; or as a return value."><span class="acronym">not nullable</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
<a class="link" href="glib-String-Utility-Functions.html#string-precision" title="String precision pitfalls">string precision pitfalls</a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>the arguments to insert in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-fprintf.returns"></a><h4>Returns</h4>
<p> the number of bytes printed.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-2.html#api-index-2.2">2.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-vfprintf"></a><h3>g_vfprintf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_vfprintf (<em class="parameter"><code><span class="type">FILE</span> *file</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>,
<em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre>
<p>An implementation of the standard <code class="function">fprintf()</code> function which supports
positional parameters, as specified in the Single Unix Specification.</p>
<div class="refsect3">
<a name="g-vfprintf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>file</p></td>
<td class="parameter_description"><p> the stream to write to. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL must not be passed as the value in, out, in-out; or as a return value."><span class="acronym">not nullable</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
<a class="link" href="glib-String-Utility-Functions.html#string-precision" title="String precision pitfalls">string precision pitfalls</a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>args</p></td>
<td class="parameter_description"><p>the list of arguments to insert in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-vfprintf.returns"></a><h4>Returns</h4>
<p> the number of bytes printed.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-2.html#api-index-2.2">2.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-sprintf"></a><h3>g_sprintf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_sprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>An implementation of the standard <code class="function">sprintf()</code> function which supports
positional parameters, as specified in the Single Unix Specification.</p>
<p>Note that it is usually better to use <a class="link" href="glib-String-Utility-Functions.html#g-snprintf" title="g_snprintf ()"><code class="function">g_snprintf()</code></a>, to avoid the
risk of buffer overflow.</p>
<p>See also <a class="link" href="glib-String-Utility-Functions.html#g-strdup-printf" title="g_strdup_printf ()"><code class="function">g_strdup_printf()</code></a>.</p>
<div class="refsect3">
<a name="g-sprintf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>A pointer to a memory buffer to contain the resulting string. It
is up to the caller to ensure that the allocated buffer is large
enough to hold the formatted result</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
<a class="link" href="glib-String-Utility-Functions.html#string-precision" title="String precision pitfalls">string precision pitfalls</a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>the arguments to insert in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-sprintf.returns"></a><h4>Returns</h4>
<p> the number of bytes printed.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-2.html#api-index-2.2">2.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-vsprintf"></a><h3>g_vsprintf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_vsprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>,
<em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre>
<p>An implementation of the standard <code class="function">vsprintf()</code> function which supports
positional parameters, as specified in the Single Unix Specification.</p>
<div class="refsect3">
<a name="g-vsprintf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>the buffer to hold the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
<a class="link" href="glib-String-Utility-Functions.html#string-precision" title="String precision pitfalls">string precision pitfalls</a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>args</p></td>
<td class="parameter_description"><p>the list of arguments to insert in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-vsprintf.returns"></a><h4>Returns</h4>
<p> the number of bytes printed.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-2.html#api-index-2.2">2.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-snprintf"></a><h3>g_snprintf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_snprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> n</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>A safer form of the standard <code class="function">sprintf()</code> function. The output is guaranteed
to not exceed <em class="parameter"><code>n</code></em>
characters (including the terminating nul character), so
it is easy to ensure that a buffer overflow cannot occur.</p>
<p>See also <a class="link" href="glib-String-Utility-Functions.html#g-strdup-printf" title="g_strdup_printf ()"><code class="function">g_strdup_printf()</code></a>.</p>
<p>In versions of GLib prior to 1.2.3, this function may return -1 if the
output was truncated, and the truncated string may not be nul-terminated.
In versions prior to 1.3.12, this function returns the length of the output
string.</p>
<p>The return value of <a class="link" href="glib-String-Utility-Functions.html#g-snprintf" title="g_snprintf ()"><code class="function">g_snprintf()</code></a> conforms to the <code class="function">snprintf()</code>
function as standardized in ISO C99. Note that this is different from
traditional <code class="function">snprintf()</code>, which returns the length of the output string.</p>
<p>The format string may contain positional parameters, as specified in
the Single Unix Specification.</p>
<div class="refsect3">
<a name="g-snprintf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>the buffer to hold the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>the maximum number of bytes to produce (including the
terminating nul character).</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
<a class="link" href="glib-String-Utility-Functions.html#string-precision" title="String precision pitfalls">string precision pitfalls</a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>the arguments to insert in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-snprintf.returns"></a><h4>Returns</h4>
<p> the number of bytes which would be produced if the buffer
was large enough.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-vsnprintf"></a><h3>g_vsnprintf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_vsnprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> n</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>,
<em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre>
<p>A safer form of the standard <code class="function">vsprintf()</code> function. The output is guaranteed
to not exceed <em class="parameter"><code>n</code></em>
characters (including the terminating nul character), so
it is easy to ensure that a buffer overflow cannot occur.</p>
<p>See also <a class="link" href="glib-String-Utility-Functions.html#g-strdup-vprintf" title="g_strdup_vprintf ()"><code class="function">g_strdup_vprintf()</code></a>.</p>
<p>In versions of GLib prior to 1.2.3, this function may return -1 if the
output was truncated, and the truncated string may not be nul-terminated.
In versions prior to 1.3.12, this function returns the length of the output
string.</p>
<p>The return value of <a class="link" href="glib-String-Utility-Functions.html#g-vsnprintf" title="g_vsnprintf ()"><code class="function">g_vsnprintf()</code></a> conforms to the <code class="function">vsnprintf()</code> function
as standardized in ISO C99. Note that this is different from traditional
<code class="function">vsnprintf()</code>, which returns the length of the output string.</p>
<p>The format string may contain positional parameters, as specified in
the Single Unix Specification.</p>
<div class="refsect3">
<a name="g-vsnprintf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>the buffer to hold the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>the maximum number of bytes to produce (including the
terminating nul character).</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
string precision pitfalls][string-precision]</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>args</p></td>
<td class="parameter_description"><p>the list of arguments to insert in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-vsnprintf.returns"></a><h4>Returns</h4>
<p> the number of bytes which would be produced if the buffer
was large enough.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-vasprintf"></a><h3>g_vasprintf ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_vasprintf (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **string</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> const *format</code></em>,
<em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre>
<p>An implementation of the GNU <code class="function">vasprintf()</code> function which supports
positional parameters, as specified in the Single Unix Specification.
This function is similar to <a class="link" href="glib-String-Utility-Functions.html#g-vsprintf" title="g_vsprintf ()"><code class="function">g_vsprintf()</code></a>, except that it allocates a
string to hold the output, instead of putting the output in a buffer
you allocate in advance.</p>
<div class="refsect3">
<a name="g-vasprintf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>the return location for the newly-allocated string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a standard <code class="function">printf()</code> format string, but notice
<a class="link" href="glib-String-Utility-Functions.html#string-precision" title="String precision pitfalls">string precision pitfalls</a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>args</p></td>
<td class="parameter_description"><p>the list of arguments to insert in the output.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-vasprintf.returns"></a><h4>Returns</h4>
<p> the number of bytes printed.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-printf-string-upper-bound"></a><h3>g_printf_string_upper_bound ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
g_printf_string_upper_bound (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
<em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre>
<p>Calculates the maximum space needed to store the output
of the <code class="function">sprintf()</code> function.</p>
<div class="refsect3">
<a name="g-printf-string-upper-bound.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>the format string. See the <code class="function">printf()</code> documentation</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>args</p></td>
<td class="parameter_description"><p>the parameters to be inserted into the format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-printf-string-upper-bound.returns"></a><h4>Returns</h4>
<p> the maximum space needed to store the formatted string</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-str-is-ascii"></a><h3>g_str_is_ascii ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_str_is_ascii (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>);</pre>
<p>Determines if a string is pure ASCII. A string is pure ASCII if it
contains no bytes with the high bit set.</p>
<div class="refsect3">
<a name="g-str-is-ascii.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>str</p></td>
<td class="parameter_description"><p>a string</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-str-is-ascii.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>str</code></em>
is ASCII</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-ascii-isalnum"></a><h3>g_ascii_isalnum ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_ascii_isalnum (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre>
<p>Determines whether a character is alphanumeric.</p>
<p>Unlike the standard C library <code class="function">isalnum()</code> function, this only
recognizes standard ASCII letters and ignores the locale,
returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also, unlike
the standard library function, this takes a char, not an int,
so don't call it on <code class="literal">EOF</code>, but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before
passing a possibly non-ASCII character in.</p>
<div class="refsect3">
<a name="g-ascii-isalnum.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>c</p></td>
<td class="parameter_description"><p>any character</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-ascii-isalnum.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em>
is an ASCII alphanumeric character</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-ascii-isalpha"></a><h3>g_ascii_isalpha ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_ascii_isalpha (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre>
<p>Determines whether a character is alphabetic (i.e. a letter).</p>
<p>Unlike the standard C library <code class="function">isalpha()</code> function, this only
recognizes standard ASCII letters and ignores the locale,
returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also, unlike
the standard library function, this takes a char, not an int,
so don't call it on <code class="literal">EOF</code>, but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before
passing a possibly non-ASCII character in.</p>
<div class="refsect3">
<a name="g-ascii-isalpha.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>c</p></td>
<td class="parameter_description"><p>any character</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-ascii-isalpha.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em>
is an ASCII alphabetic character</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-ascii-iscntrl"></a><h3>g_ascii_iscntrl ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_ascii_iscntrl (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre>
<p>Determines whether a character is a control character.</p>
<p>Unlike the standard C library <code class="function">iscntrl()</code> function, this only
recognizes standard ASCII control characters and ignores the
locale, returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also,
unlike the standard library function, this takes a char, not
an int, so don't call it on <code class="literal">EOF</code>, but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a>
before passing a possibly non-ASCII character in.</p>
<div class="refsect3">
<a name="g-ascii-iscntrl.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>c</p></td>
<td class="parameter_description"><p>any character</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-ascii-iscntrl.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em>
is an ASCII control character.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-ascii-isdigit"></a><h3>g_ascii_isdigit ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_ascii_isdigit (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre>
<p>Determines whether a character is digit (0-9).</p>
<p>Unlike the standard C library <code class="function">isdigit()</code> function, this takes
a char, not an int, so don't call it on <code class="literal">EOF</code>, but no need to
cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a possibly non-ASCII character in.</p>
<div class="refsect3">
<a name="g-ascii-isdigit.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>c</p></td>
<td class="parameter_description"><p>any character</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-ascii-isdigit.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em>
is an ASCII digit.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-ascii-isgraph"></a><h3>g_ascii_isgraph ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_ascii_isgraph (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre>
<p>Determines whether a character is a printing character and not a space.</p>
<p>Unlike the standard C library <code class="function">isgraph()</code> function, this only
recognizes standard ASCII characters and ignores the locale,
returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also, unlike
the standard library function, this takes a char, not an int,
so don't call it on <code class="literal">EOF</code>, but no need to cast to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before
passing a possibly non-ASCII character in.</p>
<div class="refsect3">
<a name="g-ascii-isgraph.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>c</p></td>
<td class="parameter_description"><p>any character</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-ascii-isgraph.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em>
is an ASCII printing character other than space.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-ascii-islower"></a><h3>g_ascii_islower ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_ascii_islower (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre>
<p>Determines whether a character is an ASCII lower case letter.</p>
<p>Unlike the standard C library <code class="function">islower()</code> function, this only
recognizes standard ASCII letters and ignores the locale,
returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also, unlike
the standard library function, this takes a char, not an int,
so don't call it on <code class="literal">EOF</code>, but no need to worry about casting
to <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> before passing a possibly non-ASCII character in.</p>
<div class="refsect3">
<a name="g-ascii-islower.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>c</p></td>
<td class="parameter_description"><p>any character</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-ascii-islower.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em>
is an ASCII lower case letter</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-ascii-isprint"></a><h3>g_ascii_isprint ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_ascii_isprint (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> c</code></em>);</pre>
<p>Determines whether a character is a printing character.</p>
<p>Unlike the standard C library <code class="function">isprint()</code> function, this only
recognizes standard ASCII characters and ignores the locale,
returning <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all non-ASCII characters. Also, unlike
the standard library function, this takes a char, not an int,
so don't call it on <code class="literal">EOF&