mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 22:38:34 +00:00
StringUtil: Remove JoinStrings
With 12 uses of `JoinStrings` in the codebase vs 36 uses of `fmt::join`, fmtlib's range adapter for string concatenation with delimiters is clearly the preferred option.
This commit is contained in:
parent
de67c4c93b
commit
5f90673686
13 changed files with 29 additions and 38 deletions
|
@ -368,21 +368,6 @@ std::vector<std::string> SplitString(const std::string& str, const char delim)
|
|||
return output;
|
||||
}
|
||||
|
||||
std::string JoinStrings(const std::vector<std::string>& strings, const std::string& delimiter)
|
||||
{
|
||||
// Check if we can return early, just for speed
|
||||
if (strings.empty())
|
||||
return "";
|
||||
|
||||
std::ostringstream res;
|
||||
std::copy(strings.begin(), strings.end(),
|
||||
std::ostream_iterator<std::string>(res, delimiter.c_str()));
|
||||
|
||||
// Drop the trailing delimiter.
|
||||
std::string joined = res.str();
|
||||
return joined.substr(0, joined.length() - delimiter.length());
|
||||
}
|
||||
|
||||
std::string TabsToSpaces(int tab_size, std::string str)
|
||||
{
|
||||
const std::string spaces(tab_size, ' ');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue