Add kascii* methods previously part of tdepim/libemailfunctions

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/307/head
Michele Calgaro 2 months ago
parent 48dd6d8de2
commit 3d22170e60
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -44,6 +44,8 @@ operator>>
operator<< operator<<
qt_qclipboard_bailout_hack qt_qclipboard_bailout_hack
kasciistricmp kasciistricmp
kasciitolower
kasciitoupper
# from libtldl # from libtldl
lt_dl* lt_dl*

@ -282,3 +282,20 @@ int kasciistricmp( const char *str1, const char *str2 )
return *s1 ? res : (*s2 ? -1 : 0); return *s1 ? res : (*s2 ? -1 : 0);
} }
char* kasciitolower( char *s )
{
if ( !s )
return 0;
for ( unsigned char *p = (unsigned char *) s; *p; ++p )
*p = ( *p >= 'A' && *p <= 'Z' ) ? (*p - 'A' + 'a') : *p;
return s;
}
char* kasciitoupper( char *s )
{
if ( !s )
return 0;
for ( unsigned char *p = (unsigned char *) s; *p; ++p )
*p = ( *p >= 'a' && *p <= 'z' ) ? (*p - 'a' + 'A') : *p;
return s;
}

@ -234,7 +234,25 @@ inline const T& kClamp( const T& x, const T& low, const T& high )
* tqstricmp fails with e.g. the Turkish locale where 'I'.lower() != 'i' * tqstricmp fails with e.g. the Turkish locale where 'I'.lower() != 'i'
* @since 3.4 * @since 3.4
*/ */
int TDECORE_EXPORT kasciistricmp( const char *str1, const char *str2 ); TDECORE_EXPORT int kasciistricmp( const char *str1, const char *str2 );
/**
Locale-independent function to convert ASCII strings to lower case ASCII
strings. This means that it affects @em only the ASCII characters A-Z.
@param str pointer to the string which should be converted to lower case
@return pointer to the converted string (same as @a str)
*/
TDECORE_EXPORT char* kasciitolower( char *str );
/**
Locale-independent function to convert ASCII strings to upper case ASCII
strings. This means that it affects @em only the ASCII characters a-z.
@param str pointer to the string which should be converted to upper case
@return pointer to the converted string (same as @a str)
*/
TDECORE_EXPORT char* kasciitoupper( char *str );
/** /**

Loading…
Cancel
Save