SDDSlib
|
Provides functions for matching strings with various matching modes. More...
#include "match_string.h"
#include "mdb.h"
#include <ctype.h>
Go to the source code of this file.
Functions | |
long | match_string (char *string, char **option, long n_options, long mode) |
Matches a given string against an array of option strings based on specified modes. | |
int | strcmp_case_insensitive (char *s1, char *s2) |
Compares two strings in a case-insensitive manner. | |
int | strncmp_case_insensitive (char *s1, char *s2, long n) |
Compares up to a specified number of characters of two strings in a case-insensitive manner. | |
Provides functions for matching strings with various matching modes.
Definition in file match_string.c.
long match_string | ( | char * | string, |
char ** | option, | ||
long | n_options, | ||
long | mode ) |
Matches a given string against an array of option strings based on specified modes.
This function searches for a match of the input string within the provided array of option strings. It supports different matching modes such as wildcard matching, case sensitivity, and whole string matching. Depending on the mode flags, it can return the first match or indicate ambiguity.
string | The string to find a match for. |
option | The array of strings to match against. |
n_options | The number of option strings in the array. |
mode | Flags that determine the matching behavior (e.g., WILDCARD_MATCH, MATCH_WHOLE_STRING, CASE_SENSITIVE, RETURN_FIRST_MATCH). |
Definition at line 34 of file match_string.c.
int strcmp_case_insensitive | ( | char * | s1, |
char * | s2 ) |
Compares two strings in a case-insensitive manner.
This function compares two null-terminated strings without considering the case of the characters. It returns an integer less than, equal to, or greater than zero if the first string is found, respectively, to be less than, to match, or be greater than the second string.
s1 | The first string to compare. |
s2 | The second string to compare. |
Definition at line 128 of file match_string.c.
int strncmp_case_insensitive | ( | char * | s1, |
char * | s2, | ||
long | n ) |
Compares up to a specified number of characters of two strings in a case-insensitive manner.
This function compares the first n characters of two null-terminated strings without considering the case of the characters. It returns an integer less than, equal to, or greater than zero if the first n characters of the first string are found, respectively, to be less than, to match, or be greater than the second string.
s1 | The first string to compare. |
s2 | The second string to compare. |
n | The maximum number of characters to compare. |
Definition at line 157 of file match_string.c.