diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2018-11-14 23:03:31 +0200 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2018-11-14 23:03:31 +0200 |
commit | 8cac4f7b135a126c096b4eb96e618aeccad1b030 (patch) | |
tree | 636957925b67cad4bb3c7e7f7af382492b3e0452 /indra/llcommon/llstring.cpp | |
parent | 31be136d4056e02cbf5c377f3544235debb7376b (diff) | |
parent | 9839a68c5a0ceba42cbe2745b4c7ef279e32813f (diff) |
Merged in lindenlab/viewer-lynx
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 { |