General Info | |
Interface: StringMan Files: lib/stringman.h Last change: 11/02/2002 Author: Luiz Henrique Shigunov | Description |
Functions | |
|
|
This page describes StringMan interface.
This interface provides many functions to manipulate strings.
int Compare(const char *s1, const char *s2);
This function compares s1 with s2.
void Concatenate(char *dest, const char *src);
This function concatenates src in dest overwriting the last 0 of dest and putting a 0 in the end of dest.
The strings may not overlap and dest must have enough space.
void Copy(char *dest, const char *src);
This function copies the string src (including final 0) to the string dest.
The strings may not overlap and dest must have enough space.
char *FindChar(const char *s, int c);
This function finds the first ocurrence of the char c in the string s.
char *FindLastChar(const char *s, int c);
This function finds the last ocurrence of the char c in the string s.
unsigned int Length(const char *s);
This function gets the size of the string s not including the last zero.
int NCompare(const char *s1, const char *s2, unsigned int count);
This function compares no more than count bytes from s1 with s2.
void NConcatenate(char *dest, const char *src, unsigned int count);
This function concatenates no more than count bytes from src in dest overwriting the final zero from dest.
The strings may not overlap and dest must have enough space.
void NCopy(char *dest, const char *src, unsigned int count);
This function copies no more than count bytes from the string src to the string dest.
The strings may not overlap and dest must have enough space.
If src is less than count, the rest of dest is filled with zeros.
int BufPrintF(char *buf, const char *fmt, ...);
This function puts in buf the formated string according to fmt.
int BufPrintFArgs(char *buf, const char *fmt, va_list args);
This function puts in buf the formated string according to fmt. args is an array of parameters.
The stdarg.h file must be included. Is in this file that va_list is defined.
long int StrToInt(const char *str, char **endstr, int base, int *error);
This function converts the string in str to a long integer value according to the given base, which must be between 2 and 36 inclusive, or be the special value 0.
The string must begin with an arbitrary amount of white space (' ', '\n', '\t', '\r', '\f', '\v') followed by a single optional '+' or '-' sign. If base is zero or 16, the string may then include a '0x' prefix, and the number will be read in base 16; otherwise, a zero base is taken as 10 (decimal) unless the next character is '0', in which case it is taken as 8 (octal).
The remainder of the string is converted to a long int value in the obvious manner, stopping at the first character which is not a valid digit in the given base. (In bases above 10, the letter 'A' in either upper or lower case represents 10, 'B' represents 11, and so forth, with 'Z' representing 35).
If endstr is not NULL, this function stores the address of the first invalid character in *endstr. If there were no digits at all, this function stores the original value of str in *endstr. (Thus, if *str is not '\0' but **endstr is '\0' on return, the entire string is valid).