cwText : Added toLower() and toUpper().

This commit is contained in:
kevin 2023-12-03 11:21:57 -05:00
parent 053675a94c
commit 453da9a6df
2 changed files with 18 additions and 0 deletions

View File

@ -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 )

View File

@ -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 );