1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>String Utility Functions</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="LibGlabels 3.0 Reference Manual">
8 <link rel="up" href="ch03.html" title="Miscellaneous">
9 <link rel="prev" href="libglabels-3.0-units.html" title="Units">
10 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
11 <link rel="stylesheet" href="style.css" type="text/css">
13 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16 <td><a accesskey="p" href="libglabels-3.0-units.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
17 <td><a accesskey="u" href="ch03.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
18 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
19 <th width="100%" align="center">LibGlabels 3.0 Reference Manual</th>
22 <tr><td colspan="5" class="shortcuts">
23 <a href="#libglabels-3.0-str.synopsis" class="shortcut">Top</a>
25 <a href="#libglabels-3.0-str.description" class="shortcut">Description</a>
28 <div class="refentry">
29 <a name="libglabels-3.0-str"></a><div class="titlepage"></div>
30 <div class="refnamediv"><table width="100%"><tr>
32 <h2><span class="refentrytitle"><a name="libglabels-3.0-str.top_of_page"></a>String Utility Functions</span></h2>
33 <p>String Utility Functions — String utility functions provided by libglabels</p>
35 <td valign="top" align="right"></td>
37 <div class="refsynopsisdiv">
38 <a name="libglabels-3.0-str.synopsis"></a><h2>Synopsis</h2>
39 <pre class="synopsis">
40 #include <libglabels/lgl-str.h>
42 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> <a class="link" href="libglabels-3.0-str.html#lgl-str-utf8-casecmp" title="lgl_str_utf8_casecmp ()">lgl_str_utf8_casecmp</a> (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *s1</code></em>,
43 <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *s2</code></em>);
44 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> <a class="link" href="libglabels-3.0-str.html#lgl-str-part-name-cmp" title="lgl_str_part_name_cmp ()">lgl_str_part_name_cmp</a> (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *s1</code></em>,
45 <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *s2</code></em>);
46 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="libglabels-3.0-str.html#lgl-str-format-fraction" title="lgl_str_format_fraction ()">lgl_str_format_fraction</a> (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x</code></em>);
49 <div class="refsect1">
50 <a name="libglabels-3.0-str.description"></a><h2>Description</h2>
52 This section defines string utility functions used by libglabels and of
53 possible use to a user of libglabels.
56 <div class="refsect1">
57 <a name="libglabels-3.0-str.details"></a><h2>Details</h2>
58 <div class="refsect2">
59 <a name="lgl-str-utf8-casecmp"></a><h3>lgl_str_utf8_casecmp ()</h3>
60 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> lgl_str_utf8_casecmp (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *s1</code></em>,
61 <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *s2</code></em>);</pre>
63 Compare two UTF-8 strings, ignoring the case of characters.
66 This function should be used only on strings that are known to be encoded
67 in UTF-8 or a compatible UTF-8 subset.
69 <div class="variablelist"><table border="0">
70 <col align="left" valign="top">
73 <td><p><span class="term"><em class="parameter"><code>s1</code></em> :</span></p></td>
74 <td>string to compare with s2.</td>
77 <td><p><span class="term"><em class="parameter"><code>s2</code></em> :</span></p></td>
78 <td>string to compare with s1.</td>
81 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
82 <td>0 if the strings match, a negative value if s1 < s2,
83 or a positive value if s1 > s2.</td>
89 <div class="refsect2">
90 <a name="lgl-str-part-name-cmp"></a><h3>lgl_str_part_name_cmp ()</h3>
91 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> lgl_str_part_name_cmp (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *s1</code></em>,
92 <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *s2</code></em>);</pre>
94 Compare two UTF-8 strings representing part names or numbers. This function
95 uses a natural sort order:
101 - Strings are divided into chunks (numeric and non-numeric)
104 - Non-numeric chunks are compared character by character
107 - Numerical chunks are compared numerically, so that "20" precedes "100".
110 - Comparison of chunks is performed left to right until the first difference
111 is encountered or all chunks evaluate as equal.
114 This function should be used only on strings that are known to be encoded
115 in UTF-8 or a compatible UTF-8 subset.
118 Numeric chunks are converted to 64 bit unsigned integers for comparison,
119 so the behaviour may be unpredictable for numeric chunks that exceed
120 18446744073709551615.
122 <div class="variablelist"><table border="0">
123 <col align="left" valign="top">
126 <td><p><span class="term"><em class="parameter"><code>s1</code></em> :</span></p></td>
127 <td>string to compare with s2.</td>
130 <td><p><span class="term"><em class="parameter"><code>s2</code></em> :</span></p></td>
131 <td>string to compare with s1.</td>
134 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
135 <td>0 if the strings match, a negative value if s1 < s2,
136 or a positive value if s1 > s2.</td>
142 <div class="refsect2">
143 <a name="lgl-str-format-fraction"></a><h3>lgl_str_format_fraction ()</h3>
144 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * lgl_str_format_fraction (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x</code></em>);</pre>
146 Create fractional representation of number, if possible. Uses UTF-8 superscripts and
147 subscripts for numerator and denominator values respecively.
149 <div class="variablelist"><table border="0">
150 <col align="left" valign="top">
153 <td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
154 <td>Floating point number to convert to fractional notation</td>
157 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
158 <td>UTF-8 string containing fractional representation of x.</td>
167 Generated by GTK-Doc V1.18</div>