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>LibGlabels 3.0 Reference Manual: String Utility Functions</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.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.20 (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="10"><tr valign="middle">
15 <td width="100%" align="left" class="shortcuts">
16 <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
17 <a href="#libglabels-3.0-str.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span>
18 <a href="#libglabels-3.0-str.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
20 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21 <td><a accesskey="u" href="ch03.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22 <td><a accesskey="p" href="libglabels-3.0-units.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23 <td><img src="right-insensitive.png" width="16" height="16" border="0"></td>
25 <div class="refentry">
26 <a name="libglabels-3.0-str"></a><div class="titlepage"></div>
27 <div class="refnamediv"><table width="100%"><tr>
29 <h2><span class="refentrytitle"><a name="libglabels-3.0-str.top_of_page"></a>String Utility Functions</span></h2>
30 <p>String Utility Functions — String utility functions provided by libglabels</p>
32 <td class="gallery_image" valign="top" align="right"></td>
34 <div class="refsect1">
35 <a name="libglabels-3.0-str.functions"></a><h2>Functions</h2>
36 <div class="informaltable"><table width="100%" border="0">
38 <col width="150px" class="functions_return">
39 <col class="functions_name">
43 <td class="function_type">
44 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
46 <td class="function_name">
47 <a class="link" href="libglabels-3.0-str.html#lgl-str-utf8-casecmp" title="lgl_str_utf8_casecmp ()">lgl_str_utf8_casecmp</a> <span class="c_punctuation">()</span>
51 <td class="function_type">
52 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
54 <td class="function_name">
55 <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> <span class="c_punctuation">()</span>
59 <td class="function_type">
60 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
62 <td class="function_name">
63 <a class="link" href="libglabels-3.0-str.html#lgl-str-format-fraction" title="lgl_str_format_fraction ()">lgl_str_format_fraction</a> <span class="c_punctuation">()</span>
69 <div class="refsect1">
70 <a name="libglabels-3.0-str.object-hierarchy"></a><h2>Object Hierarchy</h2>
74 <div class="refsect1">
75 <a name="libglabels-3.0-str.includes"></a><h2>Includes</h2>
76 <pre class="synopsis">#include <libglabels/lgl-str.h>
79 <div class="refsect1">
80 <a name="libglabels-3.0-str.description"></a><h2>Description</h2>
82 This section defines string utility functions used by libglabels and of
83 possible use to a user of libglabels.
86 <div class="refsect1">
87 <a name="libglabels-3.0-str.functions_details"></a><h2>Functions</h2>
88 <div class="refsect2">
89 <a name="lgl-str-utf8-casecmp"></a><h3>lgl_str_utf8_casecmp ()</h3>
90 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
91 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>,
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>
93 <p>Compare two UTF-8 strings, ignoring the case of characters.</p>
94 <p>This function should be used only on strings that are known to be encoded
95 in UTF-8 or a compatible UTF-8 subset.</p>
96 <div class="refsect3">
97 <a name="id-1.4.3.7.2.6"></a><h4>Parameters</h4>
98 <div class="informaltable"><table width="100%" border="0">
100 <col width="150px" class="parameters_name">
101 <col class="parameters_description">
102 <col width="200px" class="parameters_annotations">
106 <td class="parameter_name"><p>s1</p></td>
107 <td class="parameter_description"><p>string to compare with s2.</p></td>
108 <td class="parameter_annotations"> </td>
111 <td class="parameter_name"><p>s2</p></td>
112 <td class="parameter_description"><p>string to compare with s1.</p></td>
113 <td class="parameter_annotations"> </td>
118 <div class="refsect3">
119 <a name="id-1.4.3.7.2.7"></a><h4>Returns</h4>
120 <p> 0 if the strings match, a negative value if s1 < s2,
121 or a positive value if s1 > s2.</p>
126 <div class="refsect2">
127 <a name="lgl-str-part-name-cmp"></a><h3>lgl_str_part_name_cmp ()</h3>
128 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
129 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>,
130 <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>
131 <p>Compare two UTF-8 strings representing part names or numbers. This function
132 uses a natural sort order:</p>
133 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
134 <li class="listitem"><p>Ignores case.</p></li>
135 <li class="listitem"><p>Strings are divided into chunks (numeric and non-numeric)</p></li>
136 <li class="listitem"><p>Non-numeric chunks are compared character by character</p></li>
137 <li class="listitem"><p>Numerical chunks are compared numerically, so that "20" precedes "100".</p></li>
138 <li class="listitem"><p>Comparison of chunks is performed left to right until the first difference
139 is encountered or all chunks evaluate as equal.</p></li>
141 <p>This function should be used only on strings that are known to be encoded
142 in UTF-8 or a compatible UTF-8 subset.</p>
143 <p>Numeric chunks are converted to 64 bit unsigned integers for comparison,
144 so the behaviour may be unpredictable for numeric chunks that exceed
145 18446744073709551615.</p>
146 <div class="refsect3">
147 <a name="id-1.4.3.7.3.8"></a><h4>Parameters</h4>
148 <div class="informaltable"><table width="100%" border="0">
150 <col width="150px" class="parameters_name">
151 <col class="parameters_description">
152 <col width="200px" class="parameters_annotations">
156 <td class="parameter_name"><p>s1</p></td>
157 <td class="parameter_description"><p>string to compare with s2.</p></td>
158 <td class="parameter_annotations"> </td>
161 <td class="parameter_name"><p>s2</p></td>
162 <td class="parameter_description"><p>string to compare with s1.</p></td>
163 <td class="parameter_annotations"> </td>
168 <div class="refsect3">
169 <a name="id-1.4.3.7.3.9"></a><h4>Returns</h4>
170 <p> 0 if the strings match, a negative value if s1 < s2,
171 or a positive value if s1 > s2.</p>
176 <div class="refsect2">
177 <a name="lgl-str-format-fraction"></a><h3>lgl_str_format_fraction ()</h3>
178 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
179 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>
180 <p>Create fractional representation of number, if possible. Uses UTF-8 superscripts and
181 subscripts for numerator and denominator values respecively.</p>
182 <div class="refsect3">
183 <a name="id-1.4.3.7.4.5"></a><h4>Parameters</h4>
184 <div class="informaltable"><table width="100%" border="0">
186 <col width="150px" class="parameters_name">
187 <col class="parameters_description">
188 <col width="200px" class="parameters_annotations">
191 <td class="parameter_name"><p>x</p></td>
192 <td class="parameter_description"><p>Floating point number to convert to fractional notation</p></td>
193 <td class="parameter_annotations"> </td>
197 <div class="refsect3">
198 <a name="id-1.4.3.7.4.6"></a><h4>Returns</h4>
199 <p> UTF-8 string containing fractional representation of x.</p>
204 <div class="refsect1">
205 <a name="libglabels-3.0-str.other_details"></a><h2>Types and Values</h2>
210 Generated by GTK-Doc V1.20</div>