mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
StringUtil: Move ThousandSeparate() into Common namespace
This commit is contained in:
@ -211,25 +211,6 @@ inline std::string UTF8ToTStr(std::string_view str)
|
||||
std::filesystem::path StringToPath(std::string_view path);
|
||||
std::string PathToString(const std::filesystem::path& path);
|
||||
|
||||
// Thousand separator. Turns 12345678 into 12,345,678
|
||||
template <typename I>
|
||||
std::string ThousandSeparate(I value, int spaces = 0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::wostringstream stream;
|
||||
#else
|
||||
std::ostringstream stream;
|
||||
#endif
|
||||
|
||||
stream << std::setw(spaces) << value;
|
||||
|
||||
#ifdef _WIN32
|
||||
return WStringToUTF8(stream.str());
|
||||
#else
|
||||
return stream.str();
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace Common
|
||||
{
|
||||
/// Returns whether a character is printable, i.e. whether 0x20 <= c <= 0x7e is true.
|
||||
@ -258,6 +239,25 @@ inline char ToUpper(char ch)
|
||||
return std::toupper(ch, std::locale::classic());
|
||||
}
|
||||
|
||||
// Thousand separator. Turns 12345678 into 12,345,678
|
||||
template <typename I>
|
||||
std::string ThousandSeparate(I value, int spaces = 0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::wostringstream stream;
|
||||
#else
|
||||
std::ostringstream stream;
|
||||
#endif
|
||||
|
||||
stream << std::setw(spaces) << value;
|
||||
|
||||
#ifdef _WIN32
|
||||
return WStringToUTF8(stream.str());
|
||||
#else
|
||||
return stream.str();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
std::vector<std::string> CommandLineToUtf8Argv(const wchar_t* command_line);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user