diff --git a/String.cpp b/String.cpp index 86ca28ae..4d65f4bd 100644 --- a/String.cpp +++ b/String.cpp @@ -256,7 +256,7 @@ VCString CString::Split(const CString& sDelim, bool bAllowEmpty) const { } unsigned int CString::Split(const CString& sDelim, VCString& vsRet, bool bAllowEmpty) const { - vsRet.empty(); + vsRet.clear(); CString sTmp = *this; while (sTmp.size()) { @@ -346,6 +346,7 @@ CString CString::ToKBytes(double d) { return szRet; } +bool CString::ToBool() const { return (!Trim_n().Trim_n("0").empty() && CaseCmp("false") != 0); } short CString::ToShort() const { return strtoul(this->c_str(), (char**) NULL, 10); } unsigned short CString::ToUShort() const { return strtoul(this->c_str(), (char**) NULL, 10); } unsigned int CString::ToUInt() const { return strtoul(this->c_str(), (char**) NULL, 10); } diff --git a/String.h b/String.h index a1ef44c4..0154eeef 100644 --- a/String.h +++ b/String.h @@ -91,6 +91,7 @@ public: static CString ToPercent(double d); static CString ToKBytes(double d); + bool ToBool() const; short ToShort() const; unsigned short ToUShort() const; int ToInt() const;