mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
better FormatMoney
This commit is contained in:
committed by
majcosta
parent
d79a445ad1
commit
fee56e37e7
@@ -1263,13 +1263,15 @@ BOOLEAN DrawNumeralsToScreen(INT32 iNumber, INT8 bWidth, UINT16 usLocX, UINT16 u
|
|||||||
|
|
||||||
static auto FormatMoney(INT32 iNumber) -> std::wstring
|
static auto FormatMoney(INT32 iNumber) -> std::wstring
|
||||||
{
|
{
|
||||||
CHAR16 sStr[10];
|
static std::wstringstream wss([] {
|
||||||
|
std::wstringstream ss;
|
||||||
|
ss.imbue(std::locale(""));
|
||||||
|
return ss;
|
||||||
|
}());
|
||||||
|
wss.str(L"");
|
||||||
|
wss << iNumber;
|
||||||
|
|
||||||
swprintf(sStr, L"%d",iNumber);
|
return L"$" + wss.str();
|
||||||
InsertCommasForDollarFigure( sStr );
|
|
||||||
InsertDollarSignInToString( sStr );
|
|
||||||
|
|
||||||
return std::wstring(sStr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user