Design Pattern Examples
Overview of object-oriented design patterns
helpers/split.h File Reference

Declaration of the SplitList structure and the functions for working with splitting a string based on one or more delimiters. More...

#include "stringlist.h"
Include dependency graph for helpers/split.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SplitList
 Represents a collection of sub-strings split from a single string using the split() function. More...
 

Macros

#define __SPLIT_H__
 

Typedefs

typedef struct SplitList SplitList
 Represents a collection of sub-strings split from a single string using the split() function.
 

Functions

void SplitList_Clear (SplitList *list)
 Clear the given SplitList object so it can be reused again. Releases the list of sub-strings (but does not delete the sub-strings themselves, which are assumed to be pointers into an existing string).
 
void split (char *s, const char *splitChars, SplitList *components)
 Split the given path into multiple strings based on the given delimiter. The pointers to each string are returned in the given StringList object.
 

Detailed Description

Declaration of the SplitList structure and the functions for working with splitting a string based on one or more delimiters.

Definition in file helpers/split.h.

Macro Definition Documentation

◆ __SPLIT_H__

#define __SPLIT_H__

Definition at line 8 of file helpers/split.h.

Typedef Documentation

◆ SplitList

typedef struct SplitList SplitList

Represents a collection of sub-strings split from a single string using the split() function.

Function Documentation

◆ split()

void split ( char *  s,
const char *  splitChars,
SplitList components 
)

Split the given path into multiple strings based on the given delimiter. The pointers to each string are returned in the given StringList object.

Parameters
sString to split into components. Will be altered.
splitCharsA list of one or more characters on which to split the string. If NULL or empty, defaults to a single space.
componentsA SplitList object that will be updated with pointers to the sub-strings and the count of sub-strings. This object is cleared of any previous strings before being filled up again.

Definition at line 72 of file split.c.

References SplitList_AddString(), and SplitList_Clear().

Referenced by _FindEntry(), _State_DisplayText(), and getcursorposition().

◆ SplitList_Clear()

void SplitList_Clear ( SplitList list)

Clear the given SplitList object so it can be reused again. Releases the list of sub-strings (but does not delete the sub-strings themselves, which are assumed to be pointers into an existing string).

Parameters
listA SplitList object to clear.

Definition at line 30 of file split.c.

References SplitList::strings, and SplitList::strings_count.

Referenced by _FindEntry(), getcursorposition(), and split().