Top | ![]() |
![]() |
![]() |
![]() |
gchar * tepl_utils_str_middle_truncate (const gchar *str
,guint truncate_length
);
If str
is longer than truncate_length
, then this function returns str
truncated in the middle with a “…” character. Otherwise it just returns a
copy of str
.
str |
a UTF-8 string. |
|
truncate_length |
truncate the string at that length, in UTF-8 characters (not bytes). |
Since: 4.4
gchar * tepl_utils_str_end_truncate (const gchar *str
,guint truncate_length
);
Like tepl_utils_str_middle_truncate()
but the “…” character is at the end.
str |
a UTF-8 string. |
|
truncate_length |
truncate the string at that length, in UTF-8 characters (not bytes). |
Since: 4.4
gchar * tepl_utils_str_replace (const gchar *string
,const gchar *search
,const gchar *replacement
);
Replaces all occurences of search
by replacement
.
The function does only one pass, for example:
1 |
tepl_utils_str_replace ("aaaa", "aa", "a"); |
returns "aa", not "a".
Since: 4.4
gchar *
tepl_utils_get_file_extension (const gchar *filename
);
Examples:
"file.pdf" returns ".pdf".
"file.PDF" returns ".pdf".
"file.tar.gz" returns ".gz".
"path/to/file.pdf" returns ".pdf".
"file" (without an extension) returns "" (the empty string).
Since: 4.4
gchar *
tepl_utils_get_file_shortname (const gchar *filename
);
Returns filename
without its extension. With the “extension” having the same
definition as in tepl_utils_get_file_extension()
; in other words it returns
the other part of filename
.
Since: 4.4