git-svn-id: svn://db.shs.com.ru/pip@274 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-09-28 12:25:03 +00:00
parent d7579abfc0
commit a75fbf26b5
5 changed files with 14 additions and 3 deletions

View File

@@ -613,6 +613,14 @@ bool PIString::endsWith(const PIString & str) const {
}
bool PIString::toBool() const {
PIString s(*this);
s = s.trimmed().toLowerCase();
if ( atof(s.toNativeDecimalPoints().data()) > 0. || s == "true" || s == "yes" || s == "on" || s == "ok") return true;
return false;
}
PIString PIString::takeSymbol() {
PIString ret;
int sz = size_s(), ss = -1;

View File

@@ -578,7 +578,7 @@ public:
//! \brief Return \c true if string equal "true", "yes", "on" or positive not null numeric value
bool toBool() const {PIString s(*this); if (atof(s.toNativeDecimalPoints().data()) > 0. || s.trimmed().toLowerCase() == "true" || s.trimmed().toLowerCase() == "yes" || s.trimmed().toLowerCase() == "on") return true; return false;}
bool toBool() const;
//! \brief Return \c char numeric value of string
char toChar() const;