Init
This commit is contained in:
28
TorWebClient/TorClient/Utility/Utility.cs
Normal file
28
TorWebClient/TorClient/Utility/Utility.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tor
|
||||
{
|
||||
public class Utility
|
||||
{
|
||||
private Utility()
|
||||
{
|
||||
}
|
||||
public static String FormatNumber(double number,int places,bool commas=false)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
StringBuilder formatString=new StringBuilder();
|
||||
if (commas&&number>=1000.00) formatString.Append("{0:0,0.");
|
||||
else formatString.Append("{0:0.");
|
||||
for(int index=0;index<places;index++)formatString.Append("0");
|
||||
formatString.Append("}");
|
||||
if (double.NaN.Equals(number)) sb.Append("N/A");
|
||||
else sb.Append(String.Format(formatString.ToString(), number));
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user