diff options
author | Graham Linden <graham@lindenlab.com> | 2018-11-15 14:32:18 -0800 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-11-15 14:32:18 -0800 |
commit | ba1fbddc2dbc526ee89e7d79b35cf3e0a46e3add (patch) | |
tree | d779020d73e73a8eb9fa8731c362b8708c8837ef /indra/llcommon/llstring.cpp | |
parent | 2783783575a9b712eb318b450dc5e6bb17d7f7c5 (diff) | |
parent | a0a1d93fb6a74149bbef57f1d1489510247110ca (diff) |
Merge 6ish
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 { |