Add String::clear() method to clear the string.

This commit is contained in:
Tsuda Kageyu 2015-11-17 11:29:52 +09:00
parent 3128f425b8
commit 1a942627bf
3 changed files with 15 additions and 0 deletions

View File

@ -358,6 +358,12 @@ String &String::append(const String &s)
return *this;
}
String & String::clear()
{
*this = String();
return *this;
}
String String::upper() const
{
String s;

View File

@ -299,6 +299,11 @@ namespace TagLib {
*/
String &append(const String &s);
/*!
* Clears the string.
*/
String &clear();
/*!
* Returns an upper case version of the string.
*

View File

@ -67,6 +67,10 @@ public:
CPPUNIT_ASSERT(s != L"taglib");
CPPUNIT_ASSERT(s != L"taglib string taglib");
s.clear();
CPPUNIT_ASSERT(s.isEmpty());
CPPUNIT_ASSERT(!s.isNull());
String unicode("José Carlos", String::UTF8);
CPPUNIT_ASSERT(strcmp(unicode.toCString(), "Jos\xe9 Carlos") == 0);