This library provides a simple way to parse line based data.
Features:
- Easy to use.
- Support for all types of delimiters and line endings.
- Support for arbitrary boolean value notation.
- Support for categorical data.
- Support for integers in any base.
- Tiny overhead compared to dedicated solutions.
- Type safe.
Please see ReadTheDocs for the latest documentation.
A TextParser
object is initialised with a delimiter, which can consist of
more than one symbol.
#include <textparser.h>
TextParser parser(", "); // Delimiter is a comma followed by a space.
If all fields are of the same type, we can use an array.
int a[5];
parser.parseLine("1, 2, 3, 4, 5", a);
If the fields have different types, we can use multiple variables.
char a[4];
int b;
double c;
parser.parseLine("one, 2, 3.4", a, b, c);