mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
StringUtil: Make SplitString return by value
Simpler usage.
This commit is contained in:
@ -84,8 +84,7 @@ std::string EscapeFileName(const std::string& filename)
|
||||
|
||||
std::string EscapePath(const std::string& path)
|
||||
{
|
||||
std::vector<std::string> split_strings;
|
||||
SplitString(path, '/', split_strings);
|
||||
const std::vector<std::string> split_strings = SplitString(path, '/');
|
||||
|
||||
std::vector<std::string> escaped_split_strings;
|
||||
escaped_split_strings.reserve(split_strings.size());
|
||||
|
@ -341,15 +341,16 @@ void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _P
|
||||
_CompleteFilename += _Filename;
|
||||
}
|
||||
|
||||
void SplitString(const std::string& str, const char delim, std::vector<std::string>& output)
|
||||
std::vector<std::string> SplitString(const std::string& str, const char delim)
|
||||
{
|
||||
std::istringstream iss(str);
|
||||
output.resize(1);
|
||||
std::vector<std::string> output(1);
|
||||
|
||||
while (std::getline(iss, *output.rbegin(), delim))
|
||||
output.push_back("");
|
||||
|
||||
output.pop_back();
|
||||
return output;
|
||||
}
|
||||
|
||||
std::string JoinStrings(const std::vector<std::string>& strings, const std::string& delimiter)
|
||||
|
@ -106,7 +106,7 @@ bool AsciiToHex(const std::string& _szValue, u32& result);
|
||||
|
||||
std::string TabsToSpaces(int tab_size, const std::string& in);
|
||||
|
||||
void SplitString(const std::string& str, char delim, std::vector<std::string>& output);
|
||||
std::vector<std::string> SplitString(const std::string& str, char delim);
|
||||
std::string JoinStrings(const std::vector<std::string>& strings, const std::string& delimiter);
|
||||
|
||||
// "C:/Windows/winhelp.exe" to "C:/Windows/", "winhelp", ".exe"
|
||||
|
Reference in New Issue
Block a user