strsep
Parses a string with delimiters.
char * strsep ( char **stringp, const char *delim);
This function returns the next token from the string stringp which is delimited by delim. The token is terminated with a `0' character and stringp is updated to point past the token.
Parameters
stringp | the string to parse |
delim | the delimiter |
Result: returns a pointer to the token, or NULL if delim is not found in stringp..
gw_ntohl
Formats a long number to a string
unsigned long int gw_ntohl ( unsigned long int in);
This function converts the long integer netlong from network byte order to host byte order.
Parameters
in | integer netlong to convert |
Result: returns the integer long..
gw_l_byte_to_str_format
Formats a long number to a string
gchar * gw_l_byte_to_str_format ( long size );
This function creates a string from a long number. Example : 4096 => "4Kb"
Parameters
Result: the formated string. Must be freed with g_free()..
gw_ul_byte_to_str_format
Formats an unsigned long number to a string
gchar * gw_ul_byte_to_str_format ( unsigned long size );
This function creates a string from an unsigned long number. Example : 4096 => "4Kb"
Parameters
Result: the formated string. Must be freed with g_free()..
gw_ui64_byte_to_str_format
Formats an unsigned int 64 bytes number to a string
gchar * gw_ui64_byte_to_str_format ( guint64 size );
This function creates a string from an unsigned int 64 number. Example : 4096 => "4Kb"
Parameters
Result: the formated string. Must be freed with g_free()..
gw_d_byte_to_str_format
Formats a double number to a string
gchar * gw_d_byte_to_str_format ( gdouble size );
This function creates a string from a double number. Example : 4096 => "4Kb"
Parameters
Result: the formated string. Must be freed with g_free()..
gw_ld_byte_to_str_format
Formats a long double number to a string
gchar * gw_ld_byte_to_str_format ( long double size );
This function creates a string from a long double number. Example : 4096 => "4Kb"
Parameters
Result: the formated string. Must be freed with g_free()..
gw_str_format_to_ld
Calculs logn double number from a string
long double gw_str_format_to_ld ( gchar * nb);
This function calculs the long double number of bytes from a string. The string is a formated string. Example : "4Kb" => 4096
Parameters
Result: the octet number.
gw_tm_to_str_format
Formats a date from a time number
gchar * gw_tm_to_str_format ( struct tm* p);
This function creates a string from a time number.
Parameters
Result: the formated string. Must be freed with g_free()..
gw_file_to_str
Formats a string from a specified file format to displayed format
gchar * gw_file_to_str ( gchar *str);
This function replaces all "n" to "n" and all "#" to ":".
Parameters
Result: the formated string. Must be freed with g_free()..
gw_str_to_file
Formats a string to a specified file format
gchar * gw_str_to_file ( gchar *str);
This function replaces all ":" to "#" and all "n" to "n".
Parameters
Result: the formated string. Must be freed with g_free(). Returns NULL if there is no "n" or ":"..
gw_str_to_file_strb
Formats a string to a specified file format
gchar * gw_str_to_file_strb ( const gchar *str, GWStringBuffer *buf);
This function replaces all ":" to "#" and all "n" to "n".
Parameters
str | the string to format |
buf | the string buffer to store the new string |
Result: the formated string. Must be freed with g_free(). Returns NULL if there is no "n" or ":"..
gw_str_replace_str
Replaces all sub string of one string by another sub string
gchar * gw_str_replace_str ( gchar *pattern, gchar *src, gchar *dst);
This function replaces all sub string of one string by another sub string
Parameters
pattern | the string to replace sub string |
src | the sub string to replace |
dst | the sub string to put |
Result: A new allocated string. Returns NULL if there no sub string to replace or when an error occured. .
gw_str_replace_strv
Replaces all sub string of one string by another sub string
gchar * gw_str_replace_strv ( gchar *pattern, gchar **src, gchar **dst);
This function replaces all listed sub string of one string by others listed sub string. The arrays must end with NULL.
Parameters
pattern | the string to replace sub string |
src | the array of sub string to replace |
dst | the array sub string to put |
Result: A new allocated string. Returns NULL if there no sub string to replace or when an error occured. .
gw_str_blob_to_regex
Transforms a blob string to regular expression
gchar * gw_str_blob_to_regex ( gchar *blob);
This function transforms a blob string to regular expression
Parameters
blob | the blob string to transform |
Result: the regural expression. Returns NULL when an error occured. .
gw_str_key_words_to_regex
Transforms a key words string to regular expression table
gchar ** gw_str_key_words_to_regex ( gchar *key_words);
This function transforms a key words string to regular expression table
Parameters
jey_words | the key_words string to transform |
Result: the regural expression table. Returns NULL when an error occured. .
gw_strcmp_strblob
Compares a string with a blob string
gint gw_strcmp_strblob ( gchar *str, gchar *blob, gboolean case_sensitive);
This function compares a string with a blob string
Parameters
str | the string to compare |
blob | the blob string to transform |
case_sensitive | if comparaison is case sensitive |
Result: Returns 0 when the two string are equals. Returns -1 when an error occured. .
gw_strcmp_strregex
Compares a string with a regular expression string
gint gw_strcmp_strregex ( gchar *str, gchar *regex, gboolean case_sensitive);
This function compares a string with a regular expression string
Parameters
str | the string to compare |
regex | the regex string to transform |
case_sensitive | if comparaison is case sensitive |
Result: Returns 0 when the two string are equals. Returns -1 when an error occured. .
gw_strdel_chrsry
Removes all the consecutive series of the specified character in the given string.
gint gw_strdel_chrsry ( gchar *str, const gchar chr);
This function removes all the consecutive series of the specified character. In fact it removes the consecutive series of these character by only one of this character. The given string will modify. For the string "Hello world!!" with the given character ' ', this function will modify the given string to "Hello world!!".
Parameters
str | the string to removed all the consecutive series |
Result: Returns number of deleted characters. .
gw_str_trim_doubled_char
Trims all doubled characters in the string.
gint gw_str_trim_doubled_char ( gchar *str);
This function trims all doubled characters in the string.
Parameters
Result: Returns 0 when it's done. Returns -1 when an error occured. .
gw_str_trim
Removes white space from both begin and ends of this string.
gint gw_str_trim ( gchar *str);
This function removes white space from both begins and ends of this string. If the string is only white spaces, this functions returns the empty string.
Parameters
str | the string to removes white space |
Result: Returns 0 when it's done. Returns -1 when an error occured. .
gw_str_trim2
Removes white space from both begins and ends of this string.
gint gw_str_trim2 ( gchar *str);
This function removes white space from both begins ends of this string. If the string is only white spaces, this functions returns the empty string.
Parameters
str | the string to removes white space |
Result: Returns 0 when it's done. Returns -1 when an error occured. .
gw_str_trim_left
Removes white space from begins of this string.
gint gw_str_trim_left ( gchar *str);
This function removes white space from begins of this string. If the string is only white spaces, this functions returns the empty string.
Parameters
str | the string to removes white space |
Result: Returns 0 when it's done. Returns -1 when an error occured. .
gw_str_trim_right
Removes white space from ends of this string.
gint gw_str_trim_right ( gchar *str);
This function removes white space from ends of this string. If the string is only white spaces, this functions returns the empty string.
Parameters
str | the string to removes white space |
Result: Returns 0 when it's done. Returns -1 when an error occured. .
gw_str_delete_char
Deletes all specified characters in the string.
gint gw_str_delete_char ( gchar *str, gchar c);
This function deletes all specified character in the string.
Parameters
str | the string to delete character |
c | character to delete |
Result: Returns 0 when it's done. Returns -1 when an error occured. .
gw_str_replace_char
Replace all specified characters by another in the string.
gint gw_str_replace_char ( gchar *string, gchar before, gchar after);
This function replace all specified character by another in the string.
Parameters
str | the string to replace one character by another |
before | character to replace |
after | new character |
Result: Returns 0 when it's done. Returns -1 when an error occured. .
gw_str_substr
Gets the substring of a string.
gint gw_str_substr ( const gchar *str, gint begin, gint end, gchar *dest);
This function gets the substring of a string. The substring begins at the specified index begin and extends to the character at index end. Thus the length of the substring is end+1-begin
Parameters
str | the string to gets substring |
begin | begin index |
end | end index |
dest | destination of the substring (Note that dest must point to a buffer of sufficient size, size must bigger than end+1-begin) |
Result: Returns the lenght of the substring. Returns -1 when an error occured. .
gw_str_dupsubstr
Gets and allocates the substring of a string.
gint gw_str_dupsubstr ( const gchar *str, gint begin, gint end, gchar **dest);
This function gets and allocates the substring of a string. The substring begins at the specified index begin and extends to the character at index end. Thus the length of the substring is end+1-begin
Parameters
str | the string to gets substring |
begin | begin index |
end | end index |
dest | destination of the substring (Note that dest must be freed with g_free) |
Result: Returns the lenght of the substring. Returns -1 when an error occured. .
gw_str_to_lower
Converts an upper-case string to lower-case.
gint gw_str_to_lower ( gchar *str);
This function converts an upper-case string to the corresponding lower-case string.
Parameters
str | the string to convert |
Result: an error code. Returns 0 when it's done. Returns -1 when an error occured. .
gw_str_to_upper
Converts an lower-case string to upper-case.
gint gw_str_to_upper ( gchar *str);
This function converts an lower-case string to the corresponding upper-case string.
Parameters
str | the string to convert |
Result: an error code. Returns 0 when it's done. Returns -1 when an error occured. .
gw_str_to_ascii
Converts an string to ascii
gint gw_str_to_ascii ( gchar *str, gint len);
This function converts a string to the corresponding. ascii string. Replace all non-ascii caracters by spaces caracters.
Parameters
str | the string to convert |
len | length of caracters to check. If len equals -1 parse all string. |
Result: an error code. Returns 0 when it's done. Returns -1 when an error occured. .
gintlen
Gets the length of an integer.
gint gintlen ( const gint n);
This function gets the length of an integer. For example : gintlen ( 100) returns 3. gintlen ( 99) returns 2. gintlen ( 1254) returns 4.
Parameters
in | the integer to get lenght |
Result: an error code. Returns 0 when it's done. Returns -1 when an error occured. .
|