summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2017-10-03 22:26:00 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2017-10-03 22:26:00 +0100
commit36c44242133697611216375c94d637ef88cd66cc (patch)
treea1b05fd9bea575436f2a4b40535b94e9f6b93da7 /indra/llcommon
parent217df36656fb1a3d309fa0b42de192c369309211 (diff)
SL-808 - more work on arc display. area calculations still have some issues, especially for animated objects.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llstring.cpp19
-rw-r--r--indra/llcommon/llstring.h3
2 files changed, 22 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
{
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index abe5fda603..627ca05f14 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -211,6 +211,9 @@ public:
static bool getPacificDaylightTime(void) { return sPacificDaylightTime;}
static std::string getDatetimeCode (std::string key);
+
+ // Express a value like 1234567 as "1.23M"
+ static std::string getReadableNumber(F64 num);
};
/**