}
}
//---------------------------------------------------------------------------
+std::string Encode12str(const std::string & src)
+{
+std::string res;
+Encode12str(res, src);
+return res;
+}
+//---------------------------------------------------------------------------
+std::string Decode21str(const std::string & src)
+{
+std::string res;
+Decode21str(res, src);
+return res;
+}
+//---------------------------------------------------------------------------
void Encode12(char * dst, const char * src, size_t srcLen)
{
for (size_t i = 0; i <= srcLen; i++)
return result;
}
//-----------------------------------------------------------------------------
+std::string TimeToString(time_t time)
+{
+struct tm brokenTime;
+
+brokenTime.tm_wday = 0;
+brokenTime.tm_yday = 0;
+brokenTime.tm_isdst = 0;
+
+gmtime_r(&time, &brokenTime);
+
+char buf[32];
+strftime(buf, 32, "%Y-%m-%d %H:%M:%S", &brokenTime);
+
+return buf;
+}
+//-----------------------------------------------------------------------------
int ParseTariffTimeStr(const char * str, int &h1, int &m1, int &h2, int &m2)
{
char hs1[10], ms1[10], hs2[10], ms2[10];
return unsigned2str(x, s);
}
//---------------------------------------------------------------------------
+const std::string & x2str(double x, std::string & s)
+{
+char buf[256];
+snprintf(buf, sizeof(buf), "%f", x);
+s = buf;
+return s;
+}
+//---------------------------------------------------------------------------
std::string & TrimL(std::string & val)
{
size_t pos = val.find_first_not_of(" \t");
return TrimR(TrimL(val));
}
//---------------------------------------------------------------------------
+std::string Trim(const std::string & val)
+{
+std::string res(val);
+return TrimR(TrimL(res));
+}
+//---------------------------------------------------------------------------
std::string ToLower(const std::string & value)
{
std::string res;
for (std::string::size_type pos = 0; pos < value.length(); ++pos)
res += tolower(value[pos]);
- return value;
+ return res;
}
//---------------------------------------------------------------------------
std::string ToUpper(const std::string & value)
std::string res;
for (std::string::size_type pos = 0; pos < value.length(); ++pos)
res += toupper(value[pos]);
- return value;
+ return res;
}
//---------------------------------------------------------------------------
#ifdef WIN32