#include "StringUtils.h"

void StringUtils::split(std::string sourceStr, std::vector<std::string>& res, const std::string& delim)
{
	char source[512];
	strcpy(source,sourceStr.c_str());

	char deli[32];
	strcpy(deli, delim.c_str());

	char* token;
	char* ptr = source;
	while ((token = strtok(ptr, deli)) != NULL)
	{
		
		std::string temp = token;
		res.push_back(temp);
		ptr = NULL;
	}
}

void StringUtils::trim(std::string & s)
{

    if (!s.empty())
    {
		s.erase(0, s.find_first_not_of(" "));
		s.erase(s.find_last_not_of(" ") + 1);
	}

 }
