clr-format.js
0.3.0
See the version list below for details.
dotnet add package clr-format.js --version 0.3.0
NuGet\Install-Package clr-format.js -Version 0.3.0
<PackageReference Include="clr-format.js" Version="0.3.0" />
paket add clr-format.js --version 0.3.0
#r "nuget: clr-format.js, 0.3.0"
// Install clr-format.js as a Cake Addin #addin nuget:?package=clr-format.js&version=0.3.0 // Install clr-format.js as a Cake Tool #tool nuget:?package=clr-format.js&version=0.3.0
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 configuration API
Format.Config.addFormatToPrototype();
formatted = "Value:{0,10}".format("prototype"); // formatted = "Value: prototype"
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.
1. Support for all of .NET's standard and custom numeric format strings (except for currency). The only available culture format provider for now is the invariant culture.
2. Full support for index {0} and alignment {0,-10} components.
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