From cfcd1b6dd51aebc8b3e2e3fc67a0183214fe3343 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Tue, 11 Nov 2008 16:28:46 +0000 Subject: Another small DSP HLE update. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1123 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/StringUtil.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Source/Core/Common/Src/StringUtil.cpp') 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; +} + + -- cgit v1.2.3