# String Utilities

Topics
Overview | Functions

Overview

The string utility functions are general-purpose standalone functions are used to manipulate and parse null-terminated C strings. These routines are designed to be portable between DOS and UNIX. Define the __DOS__ macro at compile time for DOS and Windows applications. Define the __UNIX__ macro at compile time for generic UNIX applications.

Functions

int CaseICmp(char *s1, char *s2)

- Standalone function used to perform a case insensitive string compare. Returns -1 if s1 is less then s2, 0 if s1 equals s2 and 1 if s1 is greater then s2.

int CaseICmp(const char *s1, const char *s2)

- Standalone function used to perform a case insensitive string compare. Returns -1 if s1 is less then s2, 0 if s1 equals s2 and 1 if s1 is greater then s2.

int FindMatch(const char *str, const char *p, unsigned offset = 0)

- Finds pattern "p" in string "s" starting a specified offset. Returns index of first occurrence of matching pattern or -1 if no match is found.

int FindIMatch(const char *str, const char *p, unsigned offset = 0)

- Finds pattern "p" in string "s" starting a specified offset using a case insensitive compare. Returns index of first occurrence of matching pattern or -1 if no match is found.

int parse(char *string, char words[MAXWORDS][MAXWORDLENGTH], int *numwords, char sepchar)

- General purpose string parser used to parse a single line of text delimited by the specified separator character. The global integer constants MAXWORDS and MAXWORDLENGTH define the maximum number of words and the maximum word length that will be parsed. Both are equal to 255. The number of words parsed is passed back in the numwords variable and the actual words parsed from the line of text are passed back in the words array.

char *StringCat(char *s1=" ", char *s2= " ", char *s3=" ")

- Standalone function used to append up to three strings onto the end of each other. Returns a null-terminated string representing s2 and s3 concatenated onto the end of s1.

char *StringCat(const char *s1=" ", const char *s2= " ", const char *s3=" ")

- Standalone function used to append up to three strings onto the end of each other. Returns a null-terminated string representing s2 and s3 concatenated onto the end of s1.

End Of Document