diff --git a/cwText.cpp b/cwText.cpp index 4ed9a69..f8d0007 100644 --- a/cwText.cpp +++ b/cwText.cpp @@ -54,6 +54,21 @@ namespace cw unsigned cw::textLength( const char* s ) { return s == nullptr ? 0 : strlen(s); } +void textToLower( char* s ) +{ + if( s != nullptr ) + for(; *s; ++s) + *s = std::tolower(*s); +} + +void textToUpper( char* s ) +{ + if( s != nullptr ) + for(; *s; ++s) + *s = std::toupper(*s); +} + + int cw::textCompare( const char* s0, const char* s1 ) { if( s0 == nullptr || s1 == nullptr ) diff --git a/cwText.h b/cwText.h index 64f579d..aff115f 100644 --- a/cwText.h +++ b/cwText.h @@ -6,6 +6,9 @@ namespace cw { // Return 0 if s is null. unsigned textLength( const char* s ); + + void textToLower( char* s ); + void textToUpper( char* s ); // Note: if both s0 and s1 are nullptr then a match is indicated int textCompare( const char* s0, const char* s1 );