typestar

Humanizer in C#

Program values, turned into sentences.

using Humanizer;

// Humanizer turns program values into sentences
Console.WriteLine("snippet_count".Humanize());
Console.WriteLine("ShippedAt".Humanize(LetterCasing.LowerCase));

Console.WriteLine(3.Ordinalize());
Console.WriteLine("tour".Pluralize());
Console.WriteLine(1234.ToWords());

Console.WriteLine(TimeSpan.FromMinutes(90).Humanize());
Console.WriteLine(DateTime.UtcNow.AddHours(-3).Humanize());

How it works

  1. Humanize splits identifiers into words.
  2. Ordinalize, Pluralize and ToWords cover the number cases.
  3. TimeSpans and timestamps become relative phrases people say.

Keywords and builtins used here

The run, in numbers

Lines
12
Characters to type
405
Tokens
97
Three-star pace
95 tpm

At the three-star pace of 95 tokens a minute, this run takes about 61 seconds.

Type this snippet

Step 2 of 2 in Console & text, step 14 of 16 in The open ecosystem.

← Previous Next →