1

Hey anyone know about a function in C# that converts numerical value in to words Like If I give Input: 53904 Then the output should be: FIFTY THREE THOUSAND NINE HUNDRED FOUR ONLY

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Indrajit Sinh Rayjada
  • 1,243
  • 1
  • 14
  • 24

1 Answers1

6

By far, the best solution for this is the .NET Humanizr. It installs a series of extension methods and you can use it just like this:

15.ToWords(); // Returns "Fifteen"

int i;
i = 1587;
i.ToWords(); // Returns "One Thousand Five Hundred and Eighty Seven"

This works not only for numbers, but it works on DateTime, TimeSpan, Enums and others. I have used it in one of projects and it works great!

In addition, it has several other language translations, so it'll work in other languages, if you need it to.

Icemanind
  • 47,519
  • 50
  • 171
  • 296