This module provides a collection of functions that create, manipulate and destroy arrays of character strings.
Adds a copy to given string at end of stringarray.
- Parameters
-
csa | Stringarray to operate on |
instring | String to store |
Stores a copy to instring at the last position in csa.
Deletes a er_stringarray.
- Parameters
-
Deletes all information stored in a er_stringarray. All strings contained in it are deleted. All memory associated with csa is properly deallocated.
Get a reference to the string at position index.
- Parameters
-
csa | Stringarray to operate on |
indx | Position in Stringarray |
Returns A reference to the string stored at position indx in csa.
Creates a new er_stringarray.
- Returns
- A newly allocated er_stringarray
Checks whether there is a string present at position index.
- Parameters
-
csa | Stringarray to operate on |
indx | Position in stringarray |
- Returns
- 1 if there is, 0 if there is not.
Prints a stringarray to standardformat.
- Parameters
-
csa | Stringarray to operate on |
The format is "index : stringcontents".
Removes a string at position index.
- Parameters
-
csa | Stringarray to operate on |
indx | Position in stringarray |
Removes a string at position indx. Effectively creates a 'hole' in the stringarray.
Resizes a er_stringarray.
- Parameters
-
csa | Stringarray to resize |
size | New size of string array |
Resizes the stringarray so it can can contain size strings. If the new size is equal to the old size nothing happens. If the new size is less, all strings at the far side of the new size are properly deleted and the er_stringarray is shrunk to the new size. If the new size is larger than old size the array is grown to the new size, all string present are kept.
void er_stringarray_set |
( |
er_stringarray_t * |
csa, |
|
|
const char * |
instring, |
|
|
int |
indx |
|
) |
| |
Sets position index in stringarray to a copy of the string given.
- Parameters
-
csa | Stringarray to operate on |
instring | String to store |
indx | Position in Stringarray |
Stores a copy of instring at position indx in csa.
Returns current size aka capacity of stringarray.
- Parameters
-
csa | Stringarray to operate on |
- Returns
- Maximum number of strings the array can store