mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
New functions g_str_has_suffix and g_str_has_prefix.
2002-05-14 Alex Larsson <alexl@redhat.com> * glib/gstrfuncs.c: * glib/gstrfuncs.h: New functions g_str_has_suffix and g_str_has_prefix. * tests/string-test.c: (main): Test the new functions.
This commit is contained in:
committed by
Alexander Larsson
parent
22b31d3313
commit
c8bf903639
@@ -210,6 +210,22 @@ main (int argc,
|
||||
g_string_free (string1, TRUE);
|
||||
g_string_free (string2, TRUE);
|
||||
|
||||
g_assert (g_str_has_prefix("foobar", "gazonk") == FALSE);
|
||||
g_assert (g_str_has_prefix("xyzzy", "xyzzy") == TRUE);
|
||||
g_assert (g_str_has_prefix("xyzzy", "xy") == TRUE);
|
||||
g_assert (g_str_has_prefix("xyzzy", "") == TRUE);
|
||||
g_assert (g_str_has_prefix("xyz", "xyzzy") == FALSE);
|
||||
g_assert (g_str_has_prefix("", "xyzzy") == FALSE);
|
||||
g_assert (g_str_has_prefix("", "") == TRUE);
|
||||
|
||||
g_assert (g_str_has_suffix("foobar", "gazonk") == FALSE);
|
||||
g_assert (g_str_has_suffix("xyzzy", "xyzzy") == TRUE);
|
||||
g_assert (g_str_has_suffix("xyzzy", "zy") == TRUE);
|
||||
g_assert (g_str_has_suffix("xyzzy", "") == TRUE);
|
||||
g_assert (g_str_has_suffix("zzy", "xyzzy") == FALSE);
|
||||
g_assert (g_str_has_suffix("", "xyzzy") == FALSE);
|
||||
g_assert (g_str_has_suffix("", "") == TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user