00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00032 #ifndef __WTSTRING_H__
00033 #define __WTSTRING_H__
00034
00035 #include <stdlib.h>
00036
00037 #include "../common/platform.h"
00038
00039
00040 #define ISSPACE( c ) ( ( c ) == ' ' || ( c ) == '\f' || ( c ) == '\n' || ( c ) == '\r' || ( c ) == '\t' || ( c ) == '\v' )
00041 #define ISUPPER( c ) ( ( c ) >= 'A' && ( c ) <= 'Z' )
00042 #define ISLOWER( c ) ( ( c ) >= 'a' && ( c ) <= 'z' )
00043 #define ISALPHA( c ) ( ISUPPER( c ) || ISLOWER( c ) )
00044 #define TOUPPER( c ) ( ISLOWER( c ) ? (c) - 'a' + 'A' : ( c ) )
00045 #define TOLOWER( c ) ( ISUPPER( c ) ? (c) - 'A' + 'a' : ( c ) )
00046
00047 #define ISNUMERIC( c ) ( ( c ) >= '0' && ( c ) <= '9' )
00048 #define ISALPHANUMERIC( c ) ( ISALPHA( c ) || ISNUMERIC( c ) )
00049
00050
00051
00052
00053 size_t wt_strlcpy( char *dest, const char *source, size_t nMaxLength );
00054 size_t wt_strlcat( char *dest, const char *source, size_t nMaxLength );
00055
00056
00057 SW32 wt_stricmp( const char *string1, const char *string2 );
00058 SW32 wt_strnicmp( const char *string1, const char *string2, size_t count );
00059
00060
00061 void wt_snprintf( char *dest, size_t size, const char *format, ... );
00062
00063 char *wt_strCopy( const char *source );
00064
00065 W32 wt_strhash( const char *string, W32 length, W32 mask );
00066
00067 char *wt_strupr( char *string );
00068 char *wt_strlwr( char *string );
00069
00070
00071
00072 #define SCE_NON_NUMERIC (1 << 0) // Non-numeric value was encountered
00073 #define SCE_BUFFER_OVERFLOW (1 << 1) // Numberic overflowed
00074 #define SCE_NULL_VALUE (1 << 2) // NULL string was passed into function
00075
00076
00077 SW32 StringToInteger( const char *string, W32 *error );
00078 double StringToFloat( const char *string, W32 *error );
00079
00080
00081 #endif