From 4d0fda113432b42cdee355bf1cf1f22ed2b3af58 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 19 Feb 2024 21:58:50 -0500 Subject: [PATCH] cwText.h,cpp : Added case insensitve compare. --- cwText.cpp | 65 +++++++++++++++++++++++++++++++++++++----------------- cwText.h | 21 ++++++++++++++++-- 2 files changed, 64 insertions(+), 22 deletions(-) diff --git a/cwText.cpp b/cwText.cpp index 6e12f90..f6b4e7a 100644 --- a/cwText.cpp +++ b/cwText.cpp @@ -30,23 +30,6 @@ namespace cw return eosFl ? s : nullptr; } - /* - unsigned _toText( char* buf, unsigned bufN, unsigned char v ) - { - if( bufN < 1 ) - return 0; - buf[0] = v; - return 1; - } - - unsigned _toText( char* buf, unsigned bufN, char v ) - { - if( bufN < 1 ) - return 0; - buf[0] = v; - return 1; - } - */ } @@ -77,21 +60,43 @@ const char* cw::textCopy( char* dst, unsigned dstN, const char* src, unsigned sr return dst; } - -void textToLower( char* s ) +void cw::textToLower( char* s ) { if( s != nullptr ) for(; *s; ++s) *s = std::tolower(*s); } -void textToUpper( char* s ) +void cw::textToUpper( char* s ) { if( s != nullptr ) for(; *s; ++s) *s = std::toupper(*s); } +void cw::textToLower( char* dst, const char* src, unsigned dstN ) +{ + if( src != nullptr && dstN>0 ) + { + unsigned sn = std::min(dstN,textLength(src)+1); + unsigned i; + for(i=0; i0 ) + { + unsigned sn = std::min(dstN,textLength(src)+1); + unsigned i; + for(i=0; i