diff options
| author | John Peterson <jpeterson57@gmail.com> | 2008-11-11 16:28:46 +0000 |
|---|---|---|
| committer | John Peterson <jpeterson57@gmail.com> | 2008-11-11 16:28:46 +0000 |
| commit | cfcd1b6dd51aebc8b3e2e3fc67a0183214fe3343 (patch) | |
| tree | 2bb2d72ba6663e76483cc75633e8f1f9a4b57f1c /Source/Core/Common/Src/StringUtil.cpp | |
| parent | f38b1688cc0720cdf84af30cac0e0c7938cfab5c (diff) | |
Another small DSP HLE update.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1123 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/StringUtil.cpp')
| -rw-r--r-- | Source/Core/Common/Src/StringUtil.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index fface8ae1c..4c1163f345 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -371,3 +371,26 @@ int ChooseStringFrom(const char* str, const char* * items) }
return -1;
}
+
+
+// Thousand separator. Turns 12345678 into 12,345,678.
+std::string ThS(int a, bool b)
+{
+ char cbuf[20]; int j = 0;
+
+ // determine treatment of signed or unsigned
+ if(b) sprintf(cbuf, "%u", a); else sprintf(cbuf, "%i", a);
+
+
+ std::string sbuf = cbuf;
+ for (int i = 0; i < sbuf.length(); ++i)
+ {
+ if((i & 3) == 3)
+ {
+ sbuf.insert(sbuf.length() - i, ",");
+ }
+ }
+ return sbuf;
+}
+
+
|
