Files
sfall/sfall/Utils.h
T

42 lines
827 B
C++

#pragma once
#include <string>
#include <sstream>
#include <vector>
namespace sfall
{
// splits a string by given delimiter
// taken from: http://stackoverflow.com/a/236803/4331475
template<typename T>
void split(const std::string &s, char delim, T result, size_t limit = -1) {
std::stringstream ss;
ss.str(s);
std::string item;
size_t i = 0;
while (std::getline(ss, item, delim) && (limit == -1 || i < limit)) {
*(result++) = item;
i++;
}
}
// Splits a string by given delimiter
std::vector<std::string> split(const std::string &s, char delim);
std::string trim(const std::string& str);
void ToLowerCase(std::string& line);
bool isSpace(char c);
void strtrim(char* str);
const char* strfind(const char* source, const char* word);
void StrNormalizePath(char* path);
long GetRandom(long min, long max);
}