From 30e98ba2bbd4318c5aa4b28b324e7ef0b7f9709d Mon Sep 17 00:00:00 2001 From: prozacx Date: Tue, 5 Jul 2005 09:21:16 +0000 Subject: [PATCH] Added ToBool() git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@409 726aef4b-f618-498e-8847-2d620e286838 --- String.cpp | 3 ++- String.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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;