123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title><GString>: </title>
- <meta name="generator" content="DocBook XSL Stylesheets V1.79.2">
- <link rel="home" href="index.html" title="">
- <link rel="up" href="ch01.html" title="GLib">
- <link rel="prev" href="re60.html" title="<%GLibSpawnFlags>">
- <link rel="next" href="re62.html" title="<%GLibTestFileType>">
- <meta name="generator" content="GTK-Doc V1.33.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"></td>
- <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
- <td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
- <td><a accesskey="p" href="re60.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
- <td><a accesskey="n" href="re62.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
- </tr></table>
- <div class="refentry">
- <a name="id-1.1.62"></a><div class="titlepage"></div>
- <div class="refnamediv">
- <h2><GString></h2>
- <p><GString></p>
- </div>
- <div class="refsect1">
- <a name="id-1.1.62.2"></a><h2>Description</h2>
- <p>The GString struct contains the public fields of a GString.</p>
- </div>
- <div class="refsect1">
- <a name="id-1.1.62.3"></a><h2>Functions</h2>
- <div class="refsect2">
- <a name="id-1.1.62.3.2"></a><h3>append</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:append self val))
- </pre></div>
- <p>Adds a string onto the end of a <span class="type">GString</span>, expanding
- it if necessary.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.2.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>val</p></td>
- <td class="parameter_description">
- <p>the string to append onto the end of <em class="parameter"><code>string</code></em></p>
- <p>Passed as <code class="code">val</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.3"></a><h3>append-c</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:append-c self c))
- </pre></div>
- <p>Adds a byte onto the end of a <span class="type">GString</span>, expanding
- it if necessary.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.3.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>c</p></td>
- <td class="parameter_description">
- <p>the byte to append onto the end of <em class="parameter"><code>string</code></em></p>
- <p>Passed as <code class="code">c</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.4"></a><h3>append-len</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:append-len self val len))
- </pre></div>
- <p>Appends <em class="parameter"><code>len</code></em> bytes of <em class="parameter"><code>val</code></em> to <em class="parameter"><code>string</code></em>.
- </p>
- <p>If <em class="parameter"><code>len</code></em> is positive, <em class="parameter"><code>val</code></em> may contain embedded nuls and need
- not be nul-terminated. It is the caller's responsibility to
- ensure that <em class="parameter"><code>val</code></em> has at least <em class="parameter"><code>len</code></em> addressable bytes.
- </p>
- <p>If <em class="parameter"><code>len</code></em> is negative, <em class="parameter"><code>val</code></em> must be nul-terminated and <em class="parameter"><code>len</code></em>
- is considered to request the entire string length. This
- makes <code class="function">g_string_append_len()</code> equivalent to <code class="function">g_string_append()</code>.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.4.6"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>val</p></td>
- <td class="parameter_description">
- <p>bytes to append</p>
- <p>Passed as <code class="code">val</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>len</p></td>
- <td class="parameter_description">
- <p>number of bytes of <em class="parameter"><code>val</code></em> to use, or -1 for all of <em class="parameter"><code>val</code></em></p>
- <p>Passed as <code class="code">len</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.5"></a><h3>append-unichar</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:append-unichar self wc))
- </pre></div>
- <p>Converts a Unicode character into UTF-8, and appends it
- to the string.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.5.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>wc</p></td>
- <td class="parameter_description">
- <p>a Unicode character</p>
- <p>Passed as <code class="code">wc</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.6"></a><h3>append-uri-escaped</h3>
- <div class="informalexample"><pre class="programlisting">(define-values
- (%return)
- (string:append-uri-escaped self unescaped reserved-chars-allowed allow-utf8))
- </pre></div>
- <p>Appends <em class="parameter"><code>unescaped</code></em> to <em class="parameter"><code>string</code></em>, escaping any characters that
- are reserved in URIs using URI-style escape sequences.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.6.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>unescaped</p></td>
- <td class="parameter_description">
- <p>a string</p>
- <p>Passed as <code class="code">unescaped</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>reserved_chars_allowed</p></td>
- <td class="parameter_description">
- <p>a string of reserved characters allowed
- to be used, or <code class="constant">NULL</code></p>
- <p>Passed as <code class="code">reserved-chars-allowed</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>allow_utf8</p></td>
- <td class="parameter_description">
- <p>set <code class="constant">TRUE</code> if the escaped string may include UTF8 characters</p>
- <p>Passed as <code class="code">allow-utf8</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.7"></a><h3>ascii-down</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:ascii-down self))
- </pre></div>
- <p>Converts all uppercase ASCII letters to lowercase ASCII letters.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.7.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a GString</p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.8"></a><h3>ascii-up</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:ascii-up self))
- </pre></div>
- <p>Converts all lowercase ASCII letters to uppercase ASCII letters.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.8.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a GString</p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.9"></a><h3>assign</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:assign self rval))
- </pre></div>
- <p>Copies the bytes from a string into a <span class="type">GString</span>,
- destroying any previous contents. It is rather like
- the standard <code class="function">strcpy()</code> function, except that you do not
- have to worry about having enough space to copy the string.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.9.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>the destination <span class="type">GString</span>. Its current contents
- are destroyed.</p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>rval</p></td>
- <td class="parameter_description">
- <p>the string to copy into <em class="parameter"><code>string</code></em></p>
- <p>Passed as <code class="code">rval</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.10"></a><h3>down</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:down self))
- </pre></div>
- <p>Converts a <span class="type">GString</span> to lowercase.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.10.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.11"></a><h3>equal?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:equal? self v2))
- </pre></div>
- <p>Compares two strings for equality, returning <code class="constant">TRUE</code> if they are equal.
- For use with <span class="type">GHashTable</span>.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.11.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>v</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>v2</p></td>
- <td class="parameter_description">
- <p>another <span class="type">GString</span></p>
- <p>Passed as <code class="code">v2</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.12"></a><h3>erase</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:erase self pos len))
- </pre></div>
- <p>Removes <em class="parameter"><code>len</code></em> bytes from a <span class="type">GString</span>, starting at position <em class="parameter"><code>pos</code></em>.
- The rest of the <span class="type">GString</span> is shifted down to fill the gap.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.12.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>pos</p></td>
- <td class="parameter_description">
- <p>the position of the content to remove</p>
- <p>Passed as <code class="code">pos</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>len</p></td>
- <td class="parameter_description">
- <p>the number of bytes to remove, or -1 to remove all
- following bytes</p>
- <p>Passed as <code class="code">len</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.13"></a><h3>free</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:free self free-segment))
- </pre></div>
- <p>Frees the memory allocated for the <span class="type">GString</span>.
- If <em class="parameter"><code>free_segment</code></em> is <code class="constant">TRUE</code> it also frees the character data. If
- it's <code class="constant">FALSE</code>, the caller gains ownership of the buffer and must
- free it after use with <code class="function">g_free()</code>.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.13.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>free_segment</p></td>
- <td class="parameter_description">
- <p>if <code class="constant">TRUE</code>, the actual character data is freed as well</p>
- <p>Passed as <code class="code">free-segment</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.14"></a><h3>free-to-bytes</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:free-to-bytes self))
- </pre></div>
- <p>Transfers ownership of the contents of <em class="parameter"><code>string</code></em> to a newly allocated
- <span class="type">GBytes</span>. The <span class="type">GString</span> structure itself is deallocated, and it is
- therefore invalid to use <em class="parameter"><code>string</code></em> after invoking this function.
- </p>
- <p>Note that while <span class="type">GString</span> ensures that its buffer always has a
- trailing nul character (not reflected in its "len"), the returned
- <span class="type">GBytes</span> does not include this extra nul; i.e. it has length exactly
- equal to the "len" member.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.14.5"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.15"></a><h3>hash</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:hash self))
- </pre></div>
- <p>Creates a hash code for <em class="parameter"><code>str</code></em>; for use with <span class="type">GHashTable</span>.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.15.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>str</p></td>
- <td class="parameter_description">
- <p>a string to hash</p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.16"></a><h3>insert</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:insert self pos val))
- </pre></div>
- <p>Inserts a copy of a string into a <span class="type">GString</span>,
- expanding it if necessary.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.16.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>pos</p></td>
- <td class="parameter_description">
- <p>the position to insert the copy of the string</p>
- <p>Passed as <code class="code">pos</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>val</p></td>
- <td class="parameter_description">
- <p>the string to insert</p>
- <p>Passed as <code class="code">val</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.17"></a><h3>insert-c</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:insert-c self pos c))
- </pre></div>
- <p>Inserts a byte into a <span class="type">GString</span>, expanding it if necessary.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.17.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>pos</p></td>
- <td class="parameter_description">
- <p>the position to insert the byte</p>
- <p>Passed as <code class="code">pos</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>c</p></td>
- <td class="parameter_description">
- <p>the byte to insert</p>
- <p>Passed as <code class="code">c</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.18"></a><h3>insert-len</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:insert-len self pos val len))
- </pre></div>
- <p>Inserts <em class="parameter"><code>len</code></em> bytes of <em class="parameter"><code>val</code></em> into <em class="parameter"><code>string</code></em> at <em class="parameter"><code>pos</code></em>.
- </p>
- <p>If <em class="parameter"><code>len</code></em> is positive, <em class="parameter"><code>val</code></em> may contain embedded nuls and need
- not be nul-terminated. It is the caller's responsibility to
- ensure that <em class="parameter"><code>val</code></em> has at least <em class="parameter"><code>len</code></em> addressable bytes.
- </p>
- <p>If <em class="parameter"><code>len</code></em> is negative, <em class="parameter"><code>val</code></em> must be nul-terminated and <em class="parameter"><code>len</code></em>
- is considered to request the entire string length.
- </p>
- <p>If <em class="parameter"><code>pos</code></em> is -1, bytes are inserted at the end of the string.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.18.7"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>pos</p></td>
- <td class="parameter_description">
- <p>position in <em class="parameter"><code>string</code></em> where insertion should
- happen, or -1 for at the end</p>
- <p>Passed as <code class="code">pos</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>val</p></td>
- <td class="parameter_description">
- <p>bytes to insert</p>
- <p>Passed as <code class="code">val</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>len</p></td>
- <td class="parameter_description">
- <p>number of bytes of <em class="parameter"><code>val</code></em> to insert, or -1 for all of <em class="parameter"><code>val</code></em></p>
- <p>Passed as <code class="code">len</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.19"></a><h3>insert-unichar</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:insert-unichar self pos wc))
- </pre></div>
- <p>Converts a Unicode character into UTF-8, and insert it
- into the string at the given position.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.19.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>pos</p></td>
- <td class="parameter_description">
- <p>the position at which to insert character, or -1
- to append at the end of the string</p>
- <p>Passed as <code class="code">pos</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>wc</p></td>
- <td class="parameter_description">
- <p>a Unicode character</p>
- <p>Passed as <code class="code">wc</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.20"></a><h3>overwrite</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:overwrite self pos val))
- </pre></div>
- <p>Overwrites part of a string, lengthening it if necessary.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.20.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>pos</p></td>
- <td class="parameter_description">
- <p>the position at which to start overwriting</p>
- <p>Passed as <code class="code">pos</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>val</p></td>
- <td class="parameter_description">
- <p>the string that will overwrite the <em class="parameter"><code>string</code></em> starting at <em class="parameter"><code>pos</code></em></p>
- <p>Passed as <code class="code">val</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.21"></a><h3>overwrite-len</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:overwrite-len self pos val len))
- </pre></div>
- <p>Overwrites part of a string, lengthening it if necessary.
- This function will work with embedded nuls.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.21.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>pos</p></td>
- <td class="parameter_description">
- <p>the position at which to start overwriting</p>
- <p>Passed as <code class="code">pos</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>val</p></td>
- <td class="parameter_description">
- <p>the string that will overwrite the <em class="parameter"><code>string</code></em> starting at <em class="parameter"><code>pos</code></em></p>
- <p>Passed as <code class="code">val</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>len</p></td>
- <td class="parameter_description">
- <p>the number of bytes to write from <em class="parameter"><code>val</code></em></p>
- <p>Passed as <code class="code">len</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.22"></a><h3>prepend</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:prepend self val))
- </pre></div>
- <p>Adds a string on to the start of a <span class="type">GString</span>,
- expanding it if necessary.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.22.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>val</p></td>
- <td class="parameter_description">
- <p>the string to prepend on the start of <em class="parameter"><code>string</code></em></p>
- <p>Passed as <code class="code">val</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.23"></a><h3>prepend-c</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:prepend-c self c))
- </pre></div>
- <p>Adds a byte onto the start of a <span class="type">GString</span>,
- expanding it if necessary.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.23.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>c</p></td>
- <td class="parameter_description">
- <p>the byte to prepend on the start of the <span class="type">GString</span></p>
- <p>Passed as <code class="code">c</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.24"></a><h3>prepend-len</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:prepend-len self val len))
- </pre></div>
- <p>Prepends <em class="parameter"><code>len</code></em> bytes of <em class="parameter"><code>val</code></em> to <em class="parameter"><code>string</code></em>.
- </p>
- <p>If <em class="parameter"><code>len</code></em> is positive, <em class="parameter"><code>val</code></em> may contain embedded nuls and need
- not be nul-terminated. It is the caller's responsibility to
- ensure that <em class="parameter"><code>val</code></em> has at least <em class="parameter"><code>len</code></em> addressable bytes.
- </p>
- <p>If <em class="parameter"><code>len</code></em> is negative, <em class="parameter"><code>val</code></em> must be nul-terminated and <em class="parameter"><code>len</code></em>
- is considered to request the entire string length. This
- makes <code class="function">g_string_prepend_len()</code> equivalent to <code class="function">g_string_prepend()</code>.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.24.6"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>val</p></td>
- <td class="parameter_description">
- <p>bytes to prepend</p>
- <p>Passed as <code class="code">val</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>len</p></td>
- <td class="parameter_description">
- <p>number of bytes in <em class="parameter"><code>val</code></em> to prepend, or -1 for all of <em class="parameter"><code>val</code></em></p>
- <p>Passed as <code class="code">len</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.25"></a><h3>prepend-unichar</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:prepend-unichar self wc))
- </pre></div>
- <p>Converts a Unicode character into UTF-8, and prepends it
- to the string.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.25.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>wc</p></td>
- <td class="parameter_description">
- <p>a Unicode character</p>
- <p>Passed as <code class="code">wc</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.26"></a><h3>replace</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:replace self find replace limit))
- </pre></div>
- <p>Undocumented</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.26.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>find</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">find</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>replace</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">replace</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>limit</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">limit</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.27"></a><h3>set-size</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:set-size self len))
- </pre></div>
- <p>Sets the length of a <span class="type">GString</span>. If the length is less than
- the current length, the string will be truncated. If the
- length is greater than the current length, the contents
- of the newly added area are undefined. (However, as
- always, string->str[string->len] will be a nul byte.)</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.27.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>len</p></td>
- <td class="parameter_description">
- <p>the new length</p>
- <p>Passed as <code class="code">len</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.28"></a><h3>truncate</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:truncate self len))
- </pre></div>
- <p>Cuts off the end of the GString, leaving the first <em class="parameter"><code>len</code></em> bytes.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.28.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>len</p></td>
- <td class="parameter_description">
- <p>the new size of <em class="parameter"><code>string</code></em></p>
- <p>Passed as <code class="code">len</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.62.3.29"></a><h3>up</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:up self))
- </pre></div>
- <p>Converts a <span class="type">GString</span> to uppercase.</p>
- <div class="refsect3">
- <a name="id-1.1.62.3.29.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GString</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- </div>
- </div>
- <div class="footer">
- <hr>Generated by GTK-Doc V1.33.1</div>
- </body>
- </html>
|