Skip to content

Latest commit

 

History

History
71 lines (56 loc) · 3.78 KB

File metadata and controls

71 lines (56 loc) · 3.78 KB
id numbers-words-ordinals-roman-bytes-and-quantities
title Number and data formatting scenarios
sidebar_position 11
diataxis reference
persona returning developer

import CodeBlock from '@theme/CodeBlock'; import numbers from '!!raw-loader!../_examples/scenarios-numbers/Program.cs';

Number and data formatting scenarios

Orientation

Choose one operation instead of treating every formatted number as the same kind of string:

Task Focused guide
Spell cardinal or ordinal numbers Numbers in words and ordinals
Parse a localized number phrase Parse number words
Inflect a noun and combine it with a count Inflection and quantities
Format or parse storage and rates Byte sizes and rates
Format or parse powers of 1000 Metric numerals
Use Roman, compass, multiplier, tuple, or symbol helpers Specialized formatting utilities

Example

This verified survey sets English culture and exercises one representative call from several families:

{numbers}

Focused guides separate the typed model, parsing contract, localization behavior, and failure modes. Pass CultureInfo directly where an overload permits it; scope both ambient cultures for APIs without a culture argument.

Pitfall

Do not persist humanized number text as the numeric source of truth. ByteSize uses binary multiples, metric numerals use decimal powers, number-word parsing has locale-specific grammar, and Roman numerals have a strict range. Keep the typed value and choose a parser only for an input format the application explicitly accepts.

Version notes

The survey’s available calls compile and run against the selected package. Number-word parsing begins in 3.0.1 and changes from int to long on Humanizer 4. Culture-aware byte-rate formatting begins in 2.13.14. Historical snapshots remove or replace unavailable focused pages.

Related guides and API