mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2024-12-25 21:59:30 +01:00
New utility functions: toUpper() and toLower()
This commit is contained in:
parent
05605a63ae
commit
b039d55c81
2 changed files with 27 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
#include <cstdarg>
|
||||
|
@ -287,6 +288,22 @@ string centerAndConvert(const wstring &iWstr, unsigned int iLength, char c)
|
|||
}
|
||||
|
||||
|
||||
wstring toUpper(const wstring &iWstr)
|
||||
{
|
||||
wstring str = iWstr;
|
||||
std::transform(str.begin(), str.end(), str.begin(), towupper);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
wstring toLower(const wstring &iWstr)
|
||||
{
|
||||
wstring str = iWstr;
|
||||
std::transform(str.begin(), str.end(), str.begin(), towlower);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
unsigned int readFromUTF8(wchar_t *oString, unsigned int iWideSize,
|
||||
const char *iBuffer, unsigned int iBufSize,
|
||||
const string &iContext)
|
||||
|
|
|
@ -83,6 +83,16 @@ string padAndConvert(const wstring &iWstr, unsigned int iLength,
|
|||
string centerAndConvert(const wstring &iWstr, unsigned int iLength,
|
||||
char c = ' ');
|
||||
|
||||
/**
|
||||
* Return the upper case version of the given string
|
||||
*/
|
||||
wstring toUpper(const wstring &iWstr);
|
||||
|
||||
/**
|
||||
* Return the lower case version of the given string
|
||||
*/
|
||||
wstring toLower(const wstring &iWstr);
|
||||
|
||||
/**
|
||||
* Utility function to convert a char* buffer encoded in UTF-8 into a
|
||||
* wchar_t* string
|
||||
|
|
Loading…
Reference in a new issue