19 std::istringstream convert(st);
27 return(static_cast<std::ostringstream*>(&(std::ostringstream() << i))->str());
35 tstruct = *localtime(&now);
37 strftime(buf,
sizeof(buf),
"%Y-%m-%d", &tstruct);
42 std::vector<std::string>
split(
const std::string &text,
char sep) {
44 std::vector<std::string> tokens;
45 int start = 0, end = 0;
46 while ((
int)(end = text.find(sep, start)) != (
int)std::string::npos) {
47 std::string temp = text.substr(start, end - start);
49 tokens.push_back(temp);
52 std::string temp=text.substr(start);
54 tokens.push_back(temp);
59 float stof(std::string st) {
62 replace(st.begin(), st.end(),
',',
'.');
64 return(atof(st.c_str()));
67 std::string
trim(
const std::string &s) {
69 std::string::const_iterator it = s.begin();
70 while (it != s.end() && isspace(*it))
73 std::string::const_reverse_iterator rit = s.rbegin();
74 while (rit.base() != it && isspace(*rit))
77 return std::string(it, rit.base());
82 std::string homedir = getenv(
"HOME");
84 homedir = getpwuid(getuid())->pw_dir;
91 void Log(std::string msg) {
94 datei.open(
"/tmp/bot.log", std::ios::out | std::ios::app);
95 datei <<
"Msg: " << msg << std::endl;
std::string start(Telegram::TelegramBot *tg, Telegram::TCommandLine args)
std::vector< std::string > split(const std::string &text, char sep)
unsigned long long int uint64
void Log(std::string msg)
std::string currentDate()
uint64 stoi(std::string st)
float stof(std::string st)
std::string itos(uint64 i)
std::string trim(const std::string &s)