36 lines
956 B
C
36 lines
956 B
C
/*
|
|
* Copyright 2015 (c) Anna Schumaker.
|
|
*
|
|
* NOTE: All of these functions allocate and return a new string. It is the
|
|
* caller's responsibility to free these strings by calling g_free().
|
|
*/
|
|
#ifndef OCARINA_CORE_STRING_H
|
|
#define OCARINA_CORE_STRING_H
|
|
|
|
#include <glib.h>
|
|
#include <string.h>
|
|
|
|
|
|
/* Convert number of seconds into a string with format mm:ss. */
|
|
gchar *string_sec2str(unsigned int);
|
|
|
|
/* Convert number of seconds into a long-form time string. */
|
|
gchar *string_sec2str_long(unsigned int);
|
|
|
|
/* Convert a struct tm to a locale-dependant date string. */
|
|
gchar *string_tm2str(struct tm *);
|
|
|
|
/* Convert the input string to lowercase, dropping special characters. */
|
|
gchar *string_lowercase(const gchar *);
|
|
|
|
/*
|
|
* Compare two strings.
|
|
*
|
|
* if ret < 0: lhs < rhs, or rhs is empty.
|
|
* if ret = 0: lhs == rhs.
|
|
* if ret > 0: lhs > rhs, or lhs is empty.
|
|
*/
|
|
int string_compare(const gchar *, const gchar *);
|
|
|
|
#endif /* OCARINA_CORE_STRING_H */
|