1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
4 * (LIBGLABELS) Template library for GLABELS
6 * str.c: libGLabels string utilities
8 * Copyright (C) 2007 Jim Evins <evins@snaught.com>.
10 * This file is part of the LIBGLABELS library.
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
32 /*===========================================*/
34 /*===========================================*/
37 /*===========================================*/
39 /*===========================================*/
42 /*===========================================*/
43 /* Local function prototypes */
44 /*===========================================*/
47 /*===========================================*/
49 /*===========================================*/
52 * lgl_str_utf8_casecmp:
53 * @s1: string to compare with s2.
54 * @s2: string to compare with s1.
56 * Compare two UTF-8 strings, ignoring the case of characters.
58 * This function should be used only on strings that are known to be encoded
59 * in UTF-8 or a compatible UTF-8 subset.
61 * Returns: 0 if the strings match, a negative value if s1 < s2,
62 * or a positive value if s1 > s2.
66 lgl_str_utf8_casecmp (const gchar *s1,
73 folded_s1 = g_utf8_casefold (s1, -1);
74 folded_s2 = g_utf8_casefold (s2, -1);
76 result = g_utf8_collate (folded_s1, folded_s2);