Terbilang (netstandard2.0) is C# library for converting numeric into words in Bahasa.
using System;
using DenganID.Terbilang.Standard;
namespace TerbilangConsole
{
class Program
{
static void Main(string[] args)
{
Terbilang terbilang = new Terbilang();
var result = terbilang.From(1500027);
Console.WriteLine(result); // "satu juta lima ratus ribu dua puluh tujuh");
}
}
}
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo {Title = "WebApi", Version = "v1"}); });
services.AddTransient<ITerbilang, Terbilang>();
}
YourController.cs
private readonly ITerbilang _terbilang;
public YourController(ITerbilang terbilang)
{
_terbilang = terbilang;
}
[HttpGet("{number}")]
public IActionResult YourMethod(long number)
{
var hasil = _terbilang.From(number);
return Ok(hasil);
}
Install-Package DenganID.Terbilang.Standard -Version 1.0.0
dotnet add package DenganID.Terbilang.Standard
<PackageReference Include="DenganID.Terbilang.Standard" Version="1.0.0" />
You can always contribute to this package and create pull requests. Just give me a note
This package is released under the MIT License (MIT). Please read LICENSE.md