utils.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
Go to the source code of this file.
Functions |
| unsigned int | trim_string (char *ins, char *outs) |
| int | list_contains (const char *list, const char *value, const char *delim) |
Function Documentation
| int list_contains |
( |
const char * |
list, |
|
|
const char * |
value, |
|
|
const char * |
delim | |
|
) |
| | |
Check if a string list contains certain value
- Parameters:
-
| *list | List of values delimited by a character defined in delim |
| *value | The value searched from the list |
| *delim | Set of delimiter characters |
- Returns:
- 1 if the value is found from the list of 0 if not
Definition at line 155 of file utils.c.
| unsigned int trim_string |
( |
char * |
ins, |
|
|
char * |
outs | |
|
) |
| | |
Trim string of whitespace and control characters. Remove unwanted whitespace, linefeeds etc. (using isspace()) from the beginning and end of the string (until the first/last non-whitespace character) and control characters (using iscntrl()) from the middle.
- Parameters:
-
| ins | The input string. Must not be null. |
| outs | The output string. Must be at least as long as the input string and not null. |
- Returns:
- Length of the output string
Definition at line 96 of file utils.c.