public string ConvertNumber(int Number)
{
if (Number >= 1000)
return string.Concat(Number / 1000, "k");
else
return Number.ToString();
}
string GetKNotation(long value)
{
string[] suffix = {"", "K","M", "B", "T"}; // what's after T?
int power = 3;
while (Math.Pow(10, power) < value)
power++;
power--; //was one greater than what we needed
return (value / (long)Math.Pow(10, power)).ToString() + suffix[power/3];
}
string GetKNotation(long value)
{
string[] suffix = {"", "K","M", "B", "T"}; // what's after T?
int power = 1;
while (Math.Pow(10, power) < value)
power++;
power--; //was one greater than what we needed
return (value / (long)Math.Pow(10, power)).ToString() + suffix[power/3];
}
string GetKNotation(long value)
{
string[] suffix = {"", "k","M", "G", "T" , "P", "E", "Z", "Y"}; // what's after Y?
int power = 0;
while (Math.Pow(10, power) < value)
power += 3;
power -= 3; //was one greater than what we needed
return (value / (long)Math.Pow(10, power)).ToString() + suffix[power/3];
}
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
19 Experts available now in Live!