libcw/cwText.cpp

26 lines
612 B
C++
Raw Normal View History

2019-12-19 03:24:12 +00:00
#include "cwCommon.h"
#include "cwLog.h"
#include "cwText.h"
#include "cwCommonImpl.h"
#include "cwMem.h"
unsigned cw::textLength( const char* s )
{ return s == nullptr ? 0 : strlen(s); }
int cw::textCompare( const char* s0, const char* s1 )
{
if( s0 == nullptr || s1 == nullptr )
return s0==s1 ? 0 : 1; // if both pointers are nullptr then trigger a match
return strcmp(s0,s1);
}
int cw::textCompare( const char* s0, const char* s1, unsigned n)
{
if( s0 == nullptr || s1 == nullptr )
return s0==s1 ? 0 : 1; // if both pointers are nullptr then trigger a match
return strncmp(s0,s1,n);
}