15 #ifndef CORE_UTIL_STRING_H_
16 #define CORE_UTIL_STRING_H_
25 inline bool EndsWith(
const std::string& str,
const std::string& suffix) {
26 return str.size() >= suffix.size() &&
27 str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
30 inline bool StartsWith(
const std::string& str,
const std::string& prefix) {
31 return str.size() >= prefix.size() &&
32 str.compare(0, prefix.size(), prefix) == 0;
35 std::vector<std::string>
Split(
const std::string& s,
36 const std::string& delimiter);
52 template <
typename T,
typename... Args>
54 const Args&... parts) {
69 template <
typename... Args>
70 inline std::string
Concat(
const Args&... parts) {
71 std::ostringstream message;
void ConcatNextPart(std::ostringstream *ss)
Appends the closing string to the message.
std::string Concat(const Args &... parts)
Concatenates all arguments into a string. Equivalent to streaming all arguments into a stringstream a...
bool EndsWith(const std::string &str, const std::string &suffix)
bool StartsWith(const std::string &str, const std::string &prefix)
std::vector< std::string > Split(const std::string &s, const std::string &delimiter)