Skip to content

NumberText: Converting numbers into words in C#

Robert Greiner
Robert Greiner
1 min read

I created a project over the weekend called NumberText which provides a ToText() method that will return the textual representation of an integer.

Let's say that we have the number 1234567 and want to output one million two hundred thirty four thousand five hundred sixty seven. Using an extension method, we can call ToText() directly on an integer data type which gives the perception that ToText() is built right in to the .NET framework.

using System;
using NumberText;

namespace UsageExample {
  class NumberTextExample {
    static void Main(string[] args) {
      int testNumber = 1234567;
      Console.WriteLine(testNumber.ToText());
      Console.WriteLine(98765.ToText());
      Console.ReadKey();
    }
  }
}

Getting started with NumberText is super simple. Either add a reference to the NumberText.dll in your project, or add the NumberText.cs class in for more fine-grained control.

NumberText is hosted on Github under the Open Source Public License.

Please consider subscribing, it's free.
Technology

Robert Greiner Twitter

Professional optimist. I write a weekly newsletter for humans at the intersection of business, technology, leadership, and career growth.


Related Posts

Members Public

Navigating the Upside Down as a Technology Leader

Ideas for leading technology organizations with confidence and creativity.

Navigating the Upside Down as a Technology Leader
Members Public

Artist for a Day

The future of creative output is multiplied by AI.

Artist for a Day
Members Public

The Auto Industry's Cloud Awakening

Auto manufacturers are behind the cloud adoption curve but are well-positioned to unlock the future of mobility by building foundational capabilities across six key areas.

The Auto Industry's Cloud Awakening