Added toUpper and toLower methods in String.
git-svn-id: http://voip.null.ro/svn/yate@139 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
a966742d8e
commit
fb3db14135
|
@ -320,6 +320,28 @@ bool String::toBoolean(bool defvalue) const
|
||||||
return defvalue;
|
return defvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String& String::toUpper()
|
||||||
|
{
|
||||||
|
if (m_string) {
|
||||||
|
for (char *s = m_string; char c = *s; s++) {
|
||||||
|
if (('a' <= c) && (c <= 'z'))
|
||||||
|
*s = c + 'A' - 'a';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
String& String::toLower()
|
||||||
|
{
|
||||||
|
if (m_string) {
|
||||||
|
for (char *s = m_string; char c = *s; s++) {
|
||||||
|
if (('A' <= c) && (c <= 'Z'))
|
||||||
|
*s = c + 'a' - 'Z';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
String& String::trimBlanks()
|
String& String::trimBlanks()
|
||||||
{
|
{
|
||||||
if (m_string) {
|
if (m_string) {
|
||||||
|
|
12
yatengine.h
12
yatengine.h
|
@ -586,6 +586,18 @@ public:
|
||||||
*/
|
*/
|
||||||
bool toBoolean(bool defvalue = false) const;
|
bool toBoolean(bool defvalue = false) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn the string to an all-uppercase string
|
||||||
|
* @return A reference to this String
|
||||||
|
*/
|
||||||
|
String& toUpper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn the string to an all-lowercase string
|
||||||
|
* @return A reference to this String
|
||||||
|
*/
|
||||||
|
String& toLower();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indexing operator
|
* Indexing operator
|
||||||
* @param index Index of character in string
|
* @param index Index of character in string
|
||||||
|
|
Loading…
Reference in New Issue