From 30c3bff700396b0639d09c36c46e62d29eec31fb Mon Sep 17 00:00:00 2001 From: prozacx Date: Mon, 16 May 2005 01:27:56 +0000 Subject: [PATCH] Added ToUInt() and ToInt() git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@312 726aef4b-f618-498e-8847-2d620e286838 --- String.cpp | 8 +++++--- String.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/String.cpp b/String.cpp index 062acf5b..ea267c58 100644 --- a/String.cpp +++ b/String.cpp @@ -175,9 +175,11 @@ CString CString::ToKBytes(double d) { return szRet; } -unsigned long long CString::ToULongLong() const { return( strtoull( c_str(), NULL, 10 ) ); } -long long CString::ToLongLong() const { return( strtoll( c_str(), NULL, 10 ) ); } -double CString::ToDouble() const { return( strtod( c_str(), NULL ) ); } +unsigned int CString::ToUInt() const { return strtoul(this->c_str(), (char**) NULL, 10); } +int CString::ToInt() const { return strtoul(this->c_str(), (char**) NULL, 10); } +unsigned long long CString::ToULongLong() const { return strtoull( c_str(), NULL, 10); } +long long CString::ToLongLong() const { return strtoll(c_str(), NULL, 10); } +double CString::ToDouble() const { return strtod(c_str(), NULL); } bool CString::Trim(const CString& s) { diff --git a/String.h b/String.h index 26cffb9a..a8ba2112 100644 --- a/String.h +++ b/String.h @@ -47,7 +47,8 @@ public: static CString ToPercent(double d); static CString ToKBytes(double d); - + int ToInt() const; + unsigned int ToUInt() const; unsigned long long ToULongLong() const; long long ToLongLong() const; double ToDouble() const;