#include <stdlib.h>
#include "../common/platform.h"
Go to the source code of this file.
Defines | |
#define | ISSPACE(c) ( ( c ) == ' ' || ( c ) == '\f' || ( c ) == '\n' || ( c ) == '\r' || ( c ) == '\t' || ( c ) == '\v' ) |
#define | ISUPPER(c) ( ( c ) >= 'A' && ( c ) <= 'Z' ) |
#define | ISLOWER(c) ( ( c ) >= 'a' && ( c ) <= 'z' ) |
#define | ISALPHA(c) ( ISUPPER( c ) || ISLOWER( c ) ) |
#define | TOUPPER(c) ( ISLOWER( c ) ? (c) - 'a' + 'A' : ( c ) ) |
#define | TOLOWER(c) ( ISUPPER( c ) ? (c) - 'A' + 'a' : ( c ) ) |
#define | ISNUMERIC(c) ( ( c ) >= '0' && ( c ) <= '9' ) |
#define | ISALPHANUMERIC(c) ( ISALPHA( c ) || ISNUMERIC( c ) ) |
#define | SCE_NON_NUMERIC (1 << 0) |
#define | SCE_BUFFER_OVERFLOW (1 << 1) |
#define | SCE_NULL_VALUE (1 << 2) |
Functions | |
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. | |
size_t | wt_strlcat (char *dest, const char *source, size_t nMaxLength) |
Appends one string to another. | |
SW32 | wt_stricmp (const char *string1, const char *string2) |
Perform a lowercase comparison of strings. | |
SW32 | wt_strnicmp (const char *string1, const char *string2, size_t count) |
Compare characters of two strings without regard to case. | |
void | wt_snprintf (char *dest, size_t size, const char *format,...) |
Write formatted data to a string. | |
char * | wt_strCopy (const char *source) |
Create another copy of string. | |
W32 | wt_strhash (const char *string, W32 length, W32 mask) |
Generates a hash value from string. | |
char * | wt_strupr (char *string) |
Convert a string to uppercase. | |
char * | wt_strlwr (char *string) |
Convert a string to lowercase. | |
SW32 | StringToInteger (const char *string, W32 *error) |
Convert string to integer. | |
double | StringToFloat (const char *string, W32 *error) |
Convert string to float. |
double StringToFloat | ( | const char * | string, | |
W32 * | error | |||
) |
Convert string to float.
[in] | string | The String to be converted to a float. |
[out] | error | Error code. See header. |
SW32 StringToInteger | ( | const char * | string, | |
W32 * | error | |||
) |
Convert string to integer.
[in] | string | The String to be converted to an Integer. |
[out] | error | Error code. See header. |
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.
char* wt_strCopy | ( | const char * | source | ) |
Create another copy of string.
[in] | source | NUL-terminated string to copy. |
W32 wt_strhash | ( | const char * | string, | |
W32 | length, | |||
W32 | mask | |||
) |
Generates a hash value from string.
[in] | string | NUL-terminated string to hash. |
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
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).
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).
char* wt_strlwr | ( | char * | string | ) |
Convert a string to lowercase.
[in,out] | string | NUL-terminated string to convert to lowercase. |
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 char* wt_strupr | ( | char * | string | ) |
Convert a string to uppercase.
[in,out] | string | NUL-terminated string to capitalize. |