#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include "wtstring.h"
#include "../common/common_utils.h"
#include "../memory/memory.h"
Functions | |
PUBLIC size_t | wt_strlcpy (char *dest, const char *source, size_t nMaxLength) |
Copies a specified number of characters from a source string into a buffer. | |
PUBLIC size_t | wt_strlcat (char *dest, const char *source, size_t nMaxLength) |
Appends one string to another. | |
PUBLIC SW32 | wt_strnicmp (const char *string1, const char *string2, size_t count) |
Compare characters of two strings without regard to case. | |
PUBLIC SW32 | wt_stricmp (const char *string1, const char *string2) |
Perform a lowercase comparison of strings. | |
PUBLIC void | wt_snprintf (char *dest, size_t size, const char *format,...) |
Write formatted data to a string. | |
PUBLIC char * | wt_strupr (char *string) |
Convert a string to uppercase. | |
PUBLIC char * | wt_strlwr (char *string) |
Convert a string to lowercase. | |
PUBLIC char * | wt_strCopy (const char *source) |
Create another copy of string. |
PUBLIC void wt_snprintf | ( | char * | dest, | |
size_t | size, | |||
const char * | format, | |||
... | ||||
) |
Write formatted data to a string.
[out] | dest | Storage location for output. |
[in] | size | Maximum number of characters to store. |
[in] | format | Format-control string. |
[in] | ... | Optional arguments. |
format
is longer than dest
truncation will occur.
PUBLIC char* wt_strCopy | ( | const char * | source | ) |
Create another copy of string.
[in] | source | NUL-terminated string to copy. |
PUBLIC SW32 wt_stricmp | ( | const char * | string1, | |
const char * | string2 | |||
) |
Perform a lowercase comparison of strings.
[in] | string1 | NUL-terminated strings to compare. |
[in] | string2 | NUL-terminated strings to compare. |
string1
to string2
as follows. <0
string1
less than string2
0
string1
identical to string2
>0
string1
greater than string2
PUBLIC size_t wt_strlcat | ( | char * | dest, | |
const char * | source, | |||
size_t | nMaxLength | |||
) |
Appends one string to another.
[in,out] | dest | Pointer to a NUL-terminated string. The buffer must be large enough to contain both strings or else truncation will occur. |
[in] | source | Pointer to a NUL-terminated string from which the function copies characters. |
[in] | nMaxLength | Full size of dest, not space left. |
nMaxLength-1
characters will be copied. Always NUL-terminates (unless nMaxLength
== 0).
PUBLIC size_t wt_strlcpy | ( | char * | dest, | |
const char * | source, | |||
size_t | nMaxLength | |||
) |
Copies a specified number of characters from a source string into a buffer.
[in,out] | dest | Pointer to a buffer into which the function copies characters. |
[in] | source | Pointer to a NUL-terminated string from which the function copies characters. |
[in] | nMaxLength | Specifies the number of bytes to be copied from the string pointed to by source into the buffer pointed to by dest. |
source
. If retval
>= nMaxLength
, truncation occurred. nMaxLength-1
characters will be copied. Always NUL-terminates (unless nMaxLength
== 0).
PUBLIC char* wt_strlwr | ( | char * | string | ) |
Convert a string to lowercase.
[in,out] | string | NUL-terminated string to convert to lowercase. |
PUBLIC SW32 wt_strnicmp | ( | const char * | string1, | |
const char * | string2, | |||
size_t | count | |||
) |
Compare characters of two strings without regard to case.
[in] | string1 | NUL-terminated strings to compare. |
[in] | string2 | NUL-terminated strings to compare. |
[in] | count | Number of characters to compare. |
<0
string1
substring less than string2
substring 0
string1
substring identical to string2
substring >0
string1
substring greater than string2
substring PUBLIC char* wt_strupr | ( | char * | string | ) |
Convert a string to uppercase.
[in,out] | string | NUL-terminated string to capitalize. |