<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="PackageKit-egg-string">
<refmeta>
<refentrytitle role="top_of_page" id="PackageKit-egg-string.top_of_page">egg-string</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>PACKAGEKIT Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>egg-string</refname>
<refpurpose></refpurpose>
</refnamediv>

<refsynopsisdiv id="PackageKit-egg-string.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
<link linkend="guint">guint</link>               <link linkend="egg-strlen">egg_strlen</link>                          (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="guint">guint</link> len);
<link linkend="gboolean">gboolean</link>            <link linkend="egg-strzero">egg_strzero</link>                         (const <link linkend="gchar">gchar</link> *text);
<link linkend="gboolean">gboolean</link>            <link linkend="egg-strvequal">egg_strvequal</link>                       (<link linkend="gchar">gchar</link> **id1,
                                                         <link linkend="gchar">gchar</link> **id2);
<link linkend="gboolean">gboolean</link>            <link linkend="egg-strtoint">egg_strtoint</link>                        (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="gint">gint</link> *value);
<link linkend="gboolean">gboolean</link>            <link linkend="egg-strtouint">egg_strtouint</link>                       (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="guint">guint</link> *value);
<link linkend="gchar">gchar</link> *             <link linkend="egg-strreplace">egg_strreplace</link>                      (const <link linkend="gchar">gchar</link> *text,
                                                         const <link linkend="gchar">gchar</link> *find,
                                                         const <link linkend="gchar">gchar</link> *replace);
<link linkend="void">void</link>                <link linkend="egg-string-test">egg_string_test</link>                     (<link linkend="gpointer">gpointer</link> user_data);
</synopsis>
</refsynopsisdiv>









<refsect1 id="PackageKit-egg-string.description" role="desc">
<title role="desc.title">Description</title>
<para>
</para>
</refsect1>

<refsect1 id="PackageKit-egg-string.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="egg-strlen" role="function">
<title>egg_strlen ()</title>
<indexterm zone="egg-strlen"><primary sortas="egg_strlen">egg_strlen</primary></indexterm><programlisting><link linkend="guint">guint</link>               egg_strlen                          (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="guint">guint</link> len);</programlisting>
<para>
This function is a much safer way of doing strlen as it checks for NULL and
a stupidly long string.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara> The text to check
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> The maximum length of the string
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the length of the string, or len if the string is too long.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="egg-strzero" role="function">
<title>egg_strzero ()</title>
<indexterm zone="egg-strzero"><primary sortas="egg_strzero">egg_strzero</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            egg_strzero                         (const <link linkend="gchar">gchar</link> *text);</programlisting>
<para>
This function is a much safer way of doing "if (strlen (text) == 0))"
as it does not rely on text being NULL terminated. It's also much
quicker as it only checks the first byte rather than scanning the whole
string just to verify it's not zero length.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara> The text to check
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the string was converted correctly
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="egg-strvequal" role="function">
<title>egg_strvequal ()</title>
<indexterm zone="egg-strvequal"><primary sortas="egg_strvequal">egg_strvequal</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            egg_strvequal                       (<link linkend="gchar">gchar</link> **id1,
                                                         <link linkend="gchar">gchar</link> **id2);</programlisting>
<para>
This function will check to see if the GStrv arrays are string equal</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>id1</parameter>&#160;:</term>
<listitem><simpara> the first item of text to test
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>id2</parameter>&#160;:</term>
<listitem><simpara> the second item of text to test
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the arrays are the same, or are both <link linkend="NULL--CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="egg-strtoint" role="function">
<title>egg_strtoint ()</title>
<indexterm zone="egg-strtoint"><primary sortas="egg_strtoint">egg_strtoint</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            egg_strtoint                        (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="gint">gint</link> *value);</programlisting>
<para>
Converts a string into a signed integer value in a safe way.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara> The text the convert
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>value</parameter>&#160;:</term>
<listitem><simpara> The return numeric return value
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the string was converted correctly
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="egg-strtouint" role="function">
<title>egg_strtouint ()</title>
<indexterm zone="egg-strtouint"><primary sortas="egg_strtouint">egg_strtouint</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            egg_strtouint                       (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="guint">guint</link> *value);</programlisting>
<para>
Converts a string into a unsigned integer value in a safe way.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara> The text the convert
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>value</parameter>&#160;:</term>
<listitem><simpara> The return numeric return value
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the string was converted correctly
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="egg-strreplace" role="function">
<title>egg_strreplace ()</title>
<indexterm zone="egg-strreplace"><primary sortas="egg_strreplace">egg_strreplace</primary></indexterm><programlisting><link linkend="gchar">gchar</link> *             egg_strreplace                      (const <link linkend="gchar">gchar</link> *text,
                                                         const <link linkend="gchar">gchar</link> *find,
                                                         const <link linkend="gchar">gchar</link> *replace);</programlisting>
<para>
Replaces chars in the text with a replacement.
The <link linkend="find"><literal>find</literal></link> and <link linkend="replace"><literal>replace</literal></link> variables to not have to be of the same length</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&#160;:</term>
<listitem><simpara> The input text to make safe
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>find</parameter>&#160;:</term>
<listitem><simpara> What to search for
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>replace</parameter>&#160;:</term>
<listitem><simpara> What to replace with
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the new string (copied)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="egg-string-test" role="function">
<title>egg_string_test ()</title>
<indexterm zone="egg-string-test"><primary sortas="egg_string_test">egg_string_test</primary></indexterm><programlisting><link linkend="void">void</link>                egg_string_test                     (<link linkend="gpointer">gpointer</link> user_data);</programlisting>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
