RMBer 1.0.3
.NET 7.0
This package targets .NET 7.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package RMBer --version 1.0.3
NuGet\Install-Package RMBer -Version 1.0.3
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="RMBer" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RMBer --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RMBer, 1.0.3"
#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 RMBer as a Cake Addin #addin nuget:?package=RMBer&version=1.0.3 // Install RMBer as a Cake Tool #tool nuget:?package=RMBer&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RMBer
转换成大写人民币金额。
默认配置
默认
new Formatter()
元
整
// 全局配置
RMBer.Config(formatterOptions =>
{
formatterOptions.Yuan = Yuan.元;
formatterOptions.Zheng = Zheng.整;
});
Eg:
var number = 26_398_888;
var number1 = 26_398_888.8;
var number2 = 26_398_888.88;
var number3 = 1_564_561_565;
var number4 = -1_564_561_888;
// 默认 Format
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌元整", number.ToCapitalRMB());
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌元捌角", number1.ToCapitalRMB());
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌元捌角捌分", number2.ToCapitalRMB());
Assert.AreEqual("壹拾伍亿陆仟肆佰伍拾陆万壹仟伍佰陆拾伍元整", number3.ToCapitalRMB());
Assert.AreEqual("负壹拾伍亿陆仟肆佰伍拾陆万壹仟捌佰捌拾捌元整", number4.ToCapitalRMB());
// Format 显示方式
Formatter formatter = new Formatter();
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌元整", number.ToCapitalRMB(formatter));
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌元捌角", number1.ToCapitalRMB(formatter));
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌元捌角捌分", number2.ToCapitalRMB(formatter));
Assert.AreEqual("壹拾伍亿陆仟肆佰伍拾陆万壹仟伍佰陆拾伍元整", number3.ToCapitalRMB(formatter));
Assert.AreEqual("负壹拾伍亿陆仟肆佰伍拾陆万壹仟捌佰捌拾捌元整", number4.ToCapitalRMB(formatter));
formatter.Yuan = Yuan.元;
formatter.Zheng = Zheng.正;
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌元正", number.ToCapitalRMB(formatter));
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌元捌角", number1.ToCapitalRMB(formatter));
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌元捌角捌分", number2.ToCapitalRMB(formatter));
Assert.AreEqual("壹拾伍亿陆仟肆佰伍拾陆万壹仟伍佰陆拾伍元正", number3.ToCapitalRMB(formatter));
Assert.AreEqual("负壹拾伍亿陆仟肆佰伍拾陆万壹仟捌佰捌拾捌元正", number4.ToCapitalRMB(formatter));
formatter.Yuan = Yuan.圆;
formatter.Zheng = Zheng.正;
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌圆正", number.ToCapitalRMB(formatter));
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌圆捌角", number1.ToCapitalRMB(formatter));
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌圆捌角捌分", number2.ToCapitalRMB(formatter));
Assert.AreEqual("壹拾伍亿陆仟肆佰伍拾陆万壹仟伍佰陆拾伍圆正", number3.ToCapitalRMB(formatter));
Assert.AreEqual("负壹拾伍亿陆仟肆佰伍拾陆万壹仟捌佰捌拾捌圆正", number4.ToCapitalRMB(formatter));
formatter.Yuan = Yuan.圆;
formatter.Zheng = Zheng.整;
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌圆整", number.ToCapitalRMB(formatter));
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌圆捌角", number1.ToCapitalRMB(formatter));
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌圆捌角捌分", number2.ToCapitalRMB(formatter));
Assert.AreEqual("壹拾伍亿陆仟肆佰伍拾陆万壹仟伍佰陆拾伍圆整", number3.ToCapitalRMB(formatter));
Assert.AreEqual("负壹拾伍亿陆仟肆佰伍拾陆万壹仟捌佰捌拾捌圆整", number4.ToCapitalRMB(formatter));
formatter.Yuan = Yuan.圆;
formatter.Zheng = Zheng.整;
formatter.JiaoZheng = true;
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌圆整", number.ToCapitalRMB(formatter));
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌圆捌角整", number1.ToCapitalRMB(formatter));
Assert.AreEqual("贰仟陆佰叁拾玖万捌仟捌佰捌拾捌圆捌角捌分", number2.ToCapitalRMB(formatter));
Assert.AreEqual("壹拾伍亿陆仟肆佰伍拾陆万壹仟伍佰陆拾伍圆整", number3.ToCapitalRMB(formatter));
Assert.AreEqual("负壹拾伍亿陆仟肆佰伍拾陆万壹仟捌佰捌拾捌圆整", number4.ToCapitalRMB(formatter));
Product | Versions 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 is compatible. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.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 | 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 2.0
- No dependencies.
-
net7.0
- 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.
添加全局初始化定义。