cwText : Added toLower() and toUpper().
This commit is contained in:
parent
053675a94c
commit
453da9a6df
15
cwText.cpp
15
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 )
|
||||
|
3
cwText.h
3
cwText.h
@ -7,6 +7,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 );
|
||||
int textCompare( const char* s0, const char* s1, unsigned n);
|
||||
|
Loading…
Reference in New Issue
Block a user