Bioplib
Protein Structure C Library
|
Get a space delimited word from a string. More...
Go to the source code of this file.
Functions | |
char * | blGetWord (char *buffer, char *word, int maxlen) |
char * | blGetWordNC (char *buffer, char *word, int maxlen) |
char ** | blSplitStringOnCommas (char *string, int minItemLen) |
char ** | blSplitStringOnChars (char *string) |
Get a space delimited word from a string.
This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.
The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.
The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.
Definition in file GetWord.c.
char* blGetWord | ( | char * | buffer, |
char * | word, | ||
int | maxlen | ||
) |
[in] | *buffer | Input buffer to read words from |
[in] | maxlen | Max length of output word |
[out] | *word | Word read from buffer |
This code is a wrapper to doGetWord()
Reads a whitespace/comma delimited word out of buffer into word.
Words containing white space may be wrapped in double inverted commas. A \ is used as an escape character and maybe used to escape any following character. In particular: "\\" -> '\' To get a backslash "\ " -> ' ' To get a hard whitespace (alternatively wrap the string in double inverted commas) "\"" -> '"' To get a double inverted comma
char* blGetWordNC | ( | char * | buffer, |
char * | word, | ||
int | maxlen | ||
) |
[in] | *buffer | Input buffer to read words from |
[in] | maxlen | Max length of output word |
[out] | *word | Word read from buffer |
This code is a wrapper to doGetWord()
Reads a whitespace delimited word out of buffer into word. Commas are treated just like normal characters.
Words containing white space may be wrapped in double inverted commas. A \ is used as an escape character and maybe used to escape any following character. In particular: "\\" -> '\' To get a backslash "\ " -> ' ' To get a hard whitespace (alternatively wrap the string in double inverted commas) "\"" -> '"' To get a double inverted comma
char** blSplitStringOnChars | ( | char * | string | ) |
[in] | *string | String containing comma-separated items |
Splits a string into a list of items malloc'ing a 2D array which contains the item strings. The first dimension will be the number if items plus one. The second dimension will be 2 - a single charcater plus the \0
The last position in the first array will be set to a null string
Note that this routine malloc's a 2D array which will need to be freed
char** blSplitStringOnCommas | ( | char * | string, |
int | minItemLen | ||
) |
[in] | *string | String containing comma-separated items |
[in] | minItemLength | Min size to allocate for each item |
Splits a comma separated list of items malloc'ing a 2D array which contains the item strings. The first dimension will be the number if items plus one. The second dimension will be the maximum item length plus one, or at least minItemLen.
The last position in the first array will be set to a null string
Note that this routine malloc's a 2D array which will need to be freed