/builddir/build/BUILD/gru-0.1.0/src/string/gru_util.h File Reference
#include <assert.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "collection/gru_list.h"
#include "common/gru_portable.h"
#include "string/gru_alt.h"
Go to the source code of this file.
Functions |
gru_export char * | gru_rtrim (char *input, size_t size) |
| Removes spaces from the right side of a string.
|
gru_export char * | gru_ltrim (char *input, size_t size) |
| Removes spaces from the left side of a string.
|
gru_export char * | gru_trim (char *input, size_t size) |
| Removes spaces from all sides of a string.
|
gru_export const char * | gru_get_name_from_url (const char *url, size_t size) |
| Given an URL, this function will return the file name for the download.
|
gru_export gru_list_t * | gru_split (const char *str, char sep, gru_status_t *status) |
| Split a string.
|
gru_export void | gru_split_clean (gru_list_t *list) |
| Cleans a string list returned by gru_split and free's the memory used by the strings created for each sub-part.
|
gru_export char * | gru_str_serialize (gru_list_t *list, char sep, gru_status_t *status) |
| Serializes a string list.
|
Function Documentation
gru_export const char* gru_get_name_from_url |
( |
const char * |
url, |
|
|
size_t |
size | |
|
) |
| | |
Given an URL, this function will return the file name for the download.
- Parameters:
-
- Returns:
- the file name
gru_export char* gru_ltrim |
( |
char * |
input, |
|
|
size_t |
size | |
|
) |
| | |
Removes spaces from the left side of a string.
- Parameters:
-
| input | Input string |
| size | Size of the string |
- Returns:
- A pointer to the new string (which is the same address as input)
gru_export char* gru_rtrim |
( |
char * |
input, |
|
|
size_t |
size | |
|
) |
| | |
Removes spaces from the right side of a string.
- Parameters:
-
| input | Input string |
| size | Size of the string |
- Returns:
- A pointer to the new string (which is the same address as input)
Split a string.
- Parameters:
-
| str | the string to split |
| set | separator |
| status | status object |
- Returns:
- a gru_list_t object where each element is a subpart of the original string separated by d
gru_export void gru_split_clean |
( |
gru_list_t * |
list |
) |
|
Cleans a string list returned by gru_split and free's the memory used by the strings created for each sub-part.
- Parameters:
-
Serializes a string list.
- Parameters:
-
- Returns:
gru_export char* gru_trim |
( |
char * |
input, |
|
|
size_t |
size | |
|
) |
| | |
Removes spaces from all sides of a string.
- Parameters:
-
| input | Input string |
| size | Size of the string |
- Returns:
- A pointer to the new string (which is the same address as input)