diff options
author | Ruslan Teliuk <ruslantproductengine@lindenlab.com> | 2018-11-27 17:45:45 +0200 |
---|---|---|
committer | Ruslan Teliuk <ruslantproductengine@lindenlab.com> | 2018-11-27 17:45:45 +0200 |
commit | 4ab4c4498a04576a3cddf3533359a15a636b53b6 (patch) | |
tree | 064d6b7b40927a4b87803d6daf7f8db1a846ede6 /indra/llcommon/llstring.cpp | |
parent | acc86a9139872e182fbeb5b9fc7daa12c5d2c029 (diff) | |
parent | c21396181b090b626d7a9f989bcead2e517bb75f (diff) |
Merged lindenlab/viewer-cougar into default
Diffstat (limited to 'indra/llcommon/llstring.cpp')
-rw-r--r-- | indra/llcommon/llstring.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index c45db3b185..9a02fecd72 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -869,6 +869,25 @@ std::string LLStringOps::getDatetimeCode (std::string key) } } +std::string LLStringOps::getReadableNumber(F64 num) +{ + if (fabs(num)>=1e9) + { + return llformat("%.2lfB", num / 1e9); + } + else if (fabs(num)>=1e6) + { + return llformat("%.2lfM", num / 1e6); + } + else if (fabs(num)>=1e3) + { + return llformat("%.2lfK", num / 1e3); + } + else + { + return llformat("%.2lf", num); + } +} namespace LLStringFn { |