millify 1.0.2

dotnet add package millify --version 1.0.2                
NuGet\Install-Package millify -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="millify" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add millify --version 1.0.2                
#r "nuget: millify, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install millify as a Cake Addin
#addin nuget:?package=millify&version=1.0.2

// Install millify as a Cake Tool
#tool nuget:?package=millify&version=1.0.2                

millify-dotnet

Coverage Status License: MIT NuGet Badge

A dotnet library to convert long numbers to pretty, human-readable strings.

This library is heavily inspired by the millify NodeJS library.

Install

Get it on nuget

Package Manager
Install-Package millify
.NET CLI
> dotnet add package millify
PackageReference
<PackageReference Include="millify" />

Usage

Add the following import to the top of your csharp code file or your global Usings.cs file:

using MillifyDotnet;

To shorten any number, call the Shorten method on the Millify class.

var result = Millify.Shorten(2500);
// 2.5K

result = Millify.Shorten(1024000);
// 1.0M

The MillifyOptions class offers configurable options for the output. Further details as well as defaults can be seen in the table below.

var options = new MillifyOptions(precision: 3, lowercase: true);
var result = Millify.Shorten(1024000, options);
// 1.024m

options = new MillifyOptions(space: true, units: new[] {"B", "KB", "MB", "GB", "TB"});
result = Millify.Shorten(1440000, options);
// 1.44 MB

Options

Name Type Default Description
Precision number 1 Number of decimal places to use
Lowercase boolean false Use lowercase abbreviations
SpaceBeforeUnit boolean false Add a space between number and abbreviation
units Array<string> ['', 'K', 'M', 'B', 'T', 'P', 'E'] Optional custom unit abbreviations
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.6 is compatible.  netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 1.6

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 109 6/13/2024
1.0.1 4,217 6/4/2023
1.0.0 154 6/4/2023

- add in class documentation