tgbot-cpp
Loading...
Searching...
No Matches
StringTools.h
Go to the documentation of this file.
1#ifndef TGBOT_CPP_STRINGTOOLS_H
2#define TGBOT_CPP_STRINGTOOLS_H
3
4#include "tgbot/export.h"
5
6#include <cstddef>
7#include <vector>
8#include <string>
9#include <sstream>
10
14namespace StringTools {
15
21TGBOT_API
22bool startsWith(const std::string& str1, const std::string& str2);
23
29TGBOT_API
30bool endsWith(const std::string& str1, const std::string& str2);
31
38TGBOT_API
39void split(const std::string& str, char delimiter, std::vector<std::string>& dest);
40
45TGBOT_API
46std::string generateRandomString(std::size_t length);
47
54TGBOT_API
55std::string urlEncode(const std::string& value, const std::string& additionalLegitChars = "");
56
62TGBOT_API
63std::string urlDecode(const std::string& value);
64
72std::string escapeJsonString(const std::string& value);
73
80inline std::vector<std::string> split(const std::string& str, char delimiter) {
81 std::vector<std::string> result;
82 split(str, delimiter, result);
83 return result;
84}
85
86}
87
88#endif //TGBOT_CPP_STRINGTOOLS_H
TGBOT_API std::string generateRandomString(std::size_t length)
TGBOT_API bool startsWith(const std::string &str1, const std::string &str2)
TGBOT_API std::string urlDecode(const std::string &value)
TGBOT_API bool endsWith(const std::string &str1, const std::string &str2)
TGBOT_API void split(const std::string &str, char delimiter, std::vector< std::string > &dest)
TGBOT_API std::string urlEncode(const std::string &value, const std::string &additionalLegitChars="")
std::string escapeJsonString(const std::string &value)