summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/StringUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common/Src/StringUtil.cpp')
-rw-r--r--Source/Core/Common/Src/StringUtil.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp
index 57cfe503b7..b6b65a3e90 100644
--- a/Source/Core/Common/Src/StringUtil.cpp
+++ b/Source/Core/Common/Src/StringUtil.cpp
@@ -439,23 +439,27 @@ int ChooseStringFrom(const char* str, const char* * items)
}
-// Thousand separator. Turns 12345678 into 12,345,678.
-std::string ThS(int Integer, bool Unsigned)
+// Thousand separator. Turns 12345678 into 12,345,678
+std::string ThS(int Integer, bool Unsigned, int Spaces)
{
// Create storage space
char cbuf[20];
// Determine treatment of signed or unsigned
if(Unsigned) sprintf(cbuf, "%u", Integer); else sprintf(cbuf, "%i", Integer);
- std::string sbuf = cbuf;
- for (u32 i = 0; i < sbuf.length(); ++i)
+ std::string Sbuf = cbuf;
+ for (u32 i = 0; i < Sbuf.length(); ++i)
{
if((i & 3) == 3)
{
- sbuf.insert(sbuf.length() - i, ",");
+ Sbuf.insert(Sbuf.length() - i, ",");
}
}
- return sbuf;
+
+ // Spaces
+ std::string Spc = "";
+ for (int i = 0; i < (Spaces - Sbuf.length()); i++) Spc += " ";
+ return Spc + Sbuf;
}
void NormalizeDirSep(std::string* str)