uLib  User mode C/C++ extended API library for Win32 programmers.
String Functions

Module Description

Additional string functions and classes.
#include <uLib/StrFunc.h>

Groups

 String Allocation and Duplication
 
 MultiByte Translations
 
 Resource Strings
 
 Multi-Strings
 
 Special String Functions
 
 GUID Strings
 
 UNICODE_STRING Support
 

Classes

struct  StringEntry
 
class  StringCache
 
class  WordList
 

Macros

#define BEGIN_STRSAFE_OVERRIDE   __pragma( warning( disable:4996 ))
 
#define END_STRSAFE_OVERRIDE   __pragma( warning( default:4996 ))
 
#define _tcsecpy   strecpy
 
#define _tcsnecpy   strnecpy
 
#define _tcsistr   stristr
 
#define _tcsncpyz   strncpyz
 
#define _tcsnchr   (CSTR)memchr
 

Typedefs

typedef class StringCachePStringCache
 
typedef class WordListPWordList
 

Functions

char *__fastcall strecpy (register char *Dst, register const char *Src)
 
wchar_t *__fastcall wcsecpy (register wchar_t *Dst, register const wchar_t *Src)
 
char *__fastcall strnecpy (register char *Dst, register const char *Src, size_t N)
 
wchar_t *__fastcall wcsnecpy (register wchar_t *Dst, register const wchar_t *Src, size_t N)
 
char * stristr (const char *str, const char *pattern)
 
wchar_t * wcsistr (const wchar_t *str, const wchar_t *pattern)
 
char *__fastcall strncpyz (register char *Dst, register const char *Src, size_t Count)
 
wchar_t *__fastcall wcsncpyz (register wchar_t *Dst, register const wchar_t *Src, size_t Count)
 
size_t wcsbytes (const wchar_t *Src)
 
bool __forceinline IsString (CSTR Str)
 
template<typename chrType >
INT_PTR CharIndex (const chrType *Buffer, const chrType *Inside)
 
INT_PTR CharIndexA (const CHAR *Buffer, const CHAR *Inside)
 
INT_PTR CharIndexW (const WCHAR *Buffer, const WCHAR *Inside)
 

Macro Definition Documentation

◆ BEGIN_STRSAFE_OVERRIDE

#define BEGIN_STRSAFE_OVERRIDE   __pragma( warning( disable:4996 ))

Temporarily disable safe string deprecation warnings.

Definition at line 28 of file StrFunc.h.

◆ END_STRSAFE_OVERRIDE

#define END_STRSAFE_OVERRIDE   __pragma( warning( default:4996 ))

Definition at line 29 of file StrFunc.h.

◆ _tcsecpy

#define _tcsecpy   strecpy

Definition at line 74 of file StrFunc.h.

◆ _tcsnecpy

#define _tcsnecpy   strnecpy

Definition at line 75 of file StrFunc.h.

◆ _tcsistr

#define _tcsistr   stristr

Definition at line 76 of file StrFunc.h.

◆ _tcsncpyz

#define _tcsncpyz   strncpyz

Definition at line 77 of file StrFunc.h.

◆ _tcsnchr

#define _tcsnchr   (CSTR)memchr

Definition at line 78 of file StrFunc.h.

Typedef Documentation

◆ PStringCache

typedef class StringCache* PStringCache

Definition at line 738 of file StrFunc.h.

◆ PWordList

typedef class WordList* PWordList

Definition at line 830 of file StrFunc.h.

Function Documentation

◆ strecpy()

char* __fastcall strecpy ( register char *  Dst,
register const char *  Src 
)

strecpy() copies a string and returns a pointer to the ending NUL char in Dst.
For concatenation, strecpy() beats strcat() by a mile and a half !!
(PS. In Borland's CRTL this is (was?) called stpcpy() for some reason.)

Definition at line 37 of file StrFunc.cpp.

◆ wcsecpy()

wchar_t* __fastcall wcsecpy ( register wchar_t *  Dst,
register const wchar_t *  Src 
)

See strecpy()

Definition at line 68 of file StrFunc.cpp.

◆ strnecpy()

char* __fastcall strnecpy ( register char *  Dst,
register const char *  Src,
size_t  N 
)

Run length limited versions of strecpy() / wcsecpy().

Definition at line 77 of file StrFunc.cpp.

◆ wcsnecpy()

wchar_t* __fastcall wcsnecpy ( register wchar_t *  Dst,
register const wchar_t *  Src,
size_t  N 
)

See strnecpy()

Definition at line 84 of file StrFunc.cpp.

◆ stristr()

char* stristr ( const char *  str,
const char *  pattern 
)

stristr() is a fast case insensitive strstr().
It searches for pattern in the string str, and returns pointer to the found string, or NULL on failure.
Credits to Lefteris E for the neat algorithm !

Definition at line 96 of file StrFunc.cpp.

◆ wcsistr()

wchar_t* wcsistr ( const wchar_t *  str,
const wchar_t *  pattern 
)

See stristr()

Definition at line 113 of file StrFunc.cpp.

◆ strncpyz()

char* __fastcall strncpyz ( register char *  Dst,
register const char *  Src,
size_t  Count 
)

strncpyz() is a strncpy() with guaranteed NUL termination.
Count is the buffer length, including the NUL terminator.

Definition at line 134 of file StrFunc.cpp.

◆ wcsncpyz()

wchar_t* __fastcall wcsncpyz ( register wchar_t *  Dst,
register const wchar_t *  Src,
size_t  Count 
)

See strncpyz()

Definition at line 142 of file StrFunc.cpp.

◆ wcsbytes()

size_t wcsbytes ( const wchar_t *  Src)

Return nr of bytes (including NUL) in a wide-string.

Definition at line 154 of file StrFunc.cpp.

◆ IsString()

bool __forceinline IsString ( CSTR  Str)

IsString() checks that Str is not NULL and not blank.

Definition at line 84 of file StrFunc.h.

◆ CharIndex()

template<typename chrType >
INT_PTR CharIndex ( const chrType *  Buffer,
const chrType *  Inside 
)

CharIndex() returns the index into Buffer, of the Inside pointer, in TCHARs.

Definition at line 93 of file StrFunc.h.

◆ CharIndexA()

INT_PTR CharIndexA ( const CHAR *  Buffer,
const CHAR *  Inside 
)

◆ CharIndexW()

INT_PTR CharIndexW ( const WCHAR *  Buffer,
const WCHAR *  Inside 
)