Conflicts fixed

This commit is contained in:
Nekotekina 2014-12-26 17:06:36 +03:00
commit be2d606193
51 changed files with 1850 additions and 657 deletions

View file

@ -137,23 +137,42 @@ std::vector<std::string> fmt::split(const std::string& source, std::initializer_
std::string fmt::merge(std::vector<std::string> source, const std::string& separator)
{
std::string result;
for (auto &s : source)
if (!source.size())
{
result += s + separator;
return "";
}
return result;
std::string result;
for (int i = 0; i < source.size() - 1; ++i)
{
result += source[i] + separator;
}
return result + source[source.size() - 1];
}
std::string fmt::merge(std::initializer_list<std::vector<std::string>> sources, const std::string& separator)
{
if (!sources.size())
{
return "";
}
std::string result;
bool first = true;
for (auto &v : sources)
{
result += fmt::merge(v, separator);
if (first)
{
result = fmt::merge(v, separator);
first = false;
}
else
{
result += separator + fmt::merge(v, separator);
}
}
return result;
@ -164,4 +183,4 @@ std::string fmt::tolower(std::string source)
std::transform(source.begin(), source.end(), source.begin(), ::tolower);
return source;
}
}