SDDSlib
|
Functions for parsing tokens from strings with support for delimiters and quotations. More...
#include "mdb.h"
#include <ctype.h>
Go to the source code of this file.
Functions | |
char * | seek_level (char *s, char qs, char qe) |
int | in_charset (char c, char *s) |
char * | get_token_t (char *s, char *t) |
Extracts a token from a string based on delimiter characters. | |
char * | get_token_tq (char *s, char *ts, char *te, char *qs, char *qe) |
Extracts a token from a string with support for multiple delimiter and quotation sets. | |
void | interpret_escaped_quotes (char *s) |
Processes a string to interpret and replace escaped quotation marks. | |
Functions for parsing tokens from strings with support for delimiters and quotations.
This file provides implementations for extracting tokens from character strings based on specified delimiter sets and quotation marks. It includes functions to handle nested quotations and escaped characters, facilitating robust tokenization of complex strings.
Definition in file get_token_tq.c.
char * get_token_t | ( | char * | s, |
char * | t ) |
Extracts a token from a string based on delimiter characters.
The get_token_t
function retrieves a token from the input string s
, where a token is defined as a sequence of characters bounded by any of the delimiter characters specified in the string t
. It intelligently handles quoted sections, allowing delimiters within quotes to be part of the token.
s | The input string to parse. |
t | A string containing delimiter characters. |
Definition at line 40 of file get_token_tq.c.
char * get_token_tq | ( | char * | s, |
char * | ts, | ||
char * | te, | ||
char * | qs, | ||
char * | qe ) |
Extracts a token from a string with support for multiple delimiter and quotation sets.
The get_token_tq
function retrieves a token from the input string s
based on two sets of delimiter characters (ts
for token start and te
for token end) and two sets of quotation characters (qs
for quotation start and qe
for quotation end). It ensures that delimiters within quoted sections are ignored, allowing for nested or paired quotations.
s | The input string to parse. |
ts | A string containing token start delimiter characters. |
te | A string containing token end delimiter characters. |
qs | A string containing quotation start characters. |
qe | A string containing quotation end characters. |
Definition at line 108 of file get_token_tq.c.
int in_charset | ( | char | c, |
char * | s ) |
Definition at line 80 of file get_token_tq.c.
void interpret_escaped_quotes | ( | char * | s | ) |
Processes a string to interpret and replace escaped quotation marks.
The interpret_escaped_quotes
function scans the input string s
and replaces any escaped quotation marks (e.g., \"</tt>) with actual quotation marks (<tt>"
), effectively removing the escape character and preserving the intended quote in the string.
s | The string in which to interpret escaped quotes. |
Definition at line 192 of file get_token_tq.c.
char * seek_level | ( | char * | s, |
char | qs, | ||
char | qe ) |
Definition at line 165 of file get_token_tq.c.