To emulate the @Ravi sentence, you can search for each digit by place (one, tens, hundreds, etc.) in a user dictionary such as Dictionary<DigitPlace, Dictionary<int, string> (where you create and Enum for DigitPlace ) . Of course, that would be language specific.
Example:
Ones, 1, "one" Ones, 2, "two" ... Tens, 3, "thirty-" ... Hundreds, 6, "six-hundred" ...
If you want to follow my suggestion to create a type expander, here is an example.
public enum NumberedWords { zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5 } public static string ToName(this int value) { return (NumberedWords)value; }
Using:
int number = 5; string numberName = number.ToName();
source share