two types exist, you should avoid using the data type char. Using char will lead to a lot
of unnecessary casting.
CP_CHAR Functions
The SDK provides a few string functions that can be used for characters or character
arrays of type CP_CHAR.
To change the case of a CP_CHAR*, the following functions are used:
void CP_CharacterUpper(CP_CHAR *pS);
void CP_CharacterLower(CP_CHAR *pS);
void CP_FCharacterUpper(CP_CHAR *pS);
void CP_FCharacterLower(CP_CHAR *pS);
The first two functions, CP_CharacterUpper() and CP_CharacterLower(), are not
multi-byte safe. When dealing with multi-byte characters be sure to use
CP_FCharacterUpper() and CP_FCharacterLower().
To return the length of a CP_CHAR* array, use:
int CP_StringLen(CP_CHAR *pS);
int CP_StringByteLen(CP_CHAR *pS);
Notice that CP_StringLen() will return the number of characters in CP_CHAR*. This is
not the same as the value returned by CP_StringByteLen(), which returns the number of
bytes in a CP_CHAR. When dealing with multi-byte characters, the number of
characters and number of bytes will not be the same.
The following functions are the equivalent of the Standard C strcpy/strncpy and strcat
functions. When using multi-byte strings, be sure to use the multi-byte safe version of
string copy and concatenate.
CP_CHAR *CP_StringCopy(CP_CHAR *dest, CP_CHAR *src);
CP_CHAR *CP_StringnCopy(CP_CHAR *dest, CP_CHAR *src, int maxlen);
CP_CHAR *CP_StringByteCopy(CP_CHAR *dest, CP_CHAR *src, int maxbyte);
CP_CHAR *CP_StringCat(CP_CHAR *dest, CP_CHAR *src);
CP_CHAR *CP_StringnCat(CP_CHAR *dest ,CP_CHAR *src, int maxlen);
CP_CHAR *CP_StringByteCat(CP_CHAR *dest ,CP_CHAR *src, int maxbyte);
Finally there are functions to compare two CP_CHAR*. These functions are similar to
the standard C function strcmp, and return 0 if pS1 == pS2, <0 if pS1 > pS2 or >0 if pS2 <
pS1. CP_StringCmpi() does a case-insensitive comparison and CP_StringnCmp() will
compare the strings up to index n. When comparing multi-byte arrays, use
CP_StringByteCmp() to compare on the byte level.
int CP_StringCmp(CP_CHAR *pS1, CP_CHAR *pS2);
int CP_StringCmpi(CP_CHAR *pS1, CP_CHAR *pS2);
int CP_StringnCmp(CP_CHAR *pS1, CP_CHAR *pS2, int n);
int CP_StringByteCmp(CP_CHAR *pS1, CP_CHAR *pS2, int maxbyte);
98