clr-format.js 0.4.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package clr-format.js --version 0.4.1
NuGet\Install-Package clr-format.js -Version 0.4.1
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="clr-format.js" Version="0.4.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add clr-format.js --version 0.4.1
#r "nuget: clr-format.js, 0.4.1"
#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 clr-format.js as a Cake Addin
#addin nuget:?package=clr-format.js&version=0.4.1

// Install clr-format.js as a Cake Tool
#tool nuget:?package=clr-format.js&version=0.4.1

The implementation of this string formatting function is inspired by .NET's (and other Microsoft® products') Composite Formatting feature. Therefore the final behaviour should be similar to what's described in the Getting started with the String.Format method MSDN article. The main difference is that method names in JavaScript are intrinsically camelcase therefore String.format should be used instead.

The API documentation can be refered for more details at https://clr-format.github.io/clr-format/

Usage:
 var formatted = String.format("Value: {0:00-00}", 345.6); // formatted = "Value: 03-46"
 formatted = String.format("Value: {0,-2}{1}", 1, "text"); // formatted = "Value: 1 text"

 // Using the globalization API (clr-format-intl.js)
 Format.setCulture("de-DE");
 formatted = String.format("{0:N2}", -1234.56); // formatted = "-1.234,56"
 formatted = String.format("{0:#0.0#;(#0.0#,);-0-}", -1234.5); // formatted = "(1,23)"

 Format.setCurrency("EUR");
 formatted = String.format("{0:c}", 1230); // formatted = "1.230,00 €"

 // Using the chainable configuration API (clr-format-config.js)
 Format.Config.addFormatToPrototype().addToStringOverload();

 formatted = "Value:{0,10}".format("prototype"); // formatted = "Value: prototype"
 formatted = (1234.5678).toString("#,0.00"); // formatted = "1,234.57"

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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
0.5.0 1,480 9/23/2015
0.4.1 1,107 9/16/2015
0.4.0 1,098 9/12/2015
0.3.3 1,023 9/1/2015
0.3.2 1,022 8/29/2015
0.3.1 1,024 8/28/2015
0.3.0 1,043 8/28/2015
0.2.0 1,090 8/21/2015
0.1.3 1,338 8/3/2015
0.1.2 1,215 7/16/2015

1. Support for all of .NET's standard and custom numeric format strings (except for currency with the invariant culture).
2. Optional globalization API contained in clr-format-intl.js that allows for culture-specific number and currency formatting via the Format.setCulture and Format.setCurrency methods.
3. Optional configuration API contained in clr-format-config.js and defined under the Format.Config namespace. See https://clr-format.github.io/clr-format/modules/format.config.html