Questions tagged [numbers-to-words]

Converting numbers to their English representation is a common programming challenge where the goal is to take a number as input and output it's English equivalent. For example: input 1024; output "One Thousand Twenty-Four".

Filter by
Sorted by
Tagged with
3 votes
0 answers
105 views

Generation and parsing of English numerals (cardinal and ordinal)

I need to use the English numerals (American) in Haskell, so I looked for a library that did it. I have not found one, therefore I developed the program that I am presenting here. There are actually ...
Alberto Capitani's user avatar
0 votes
3 answers
201 views

My take at ProjectEuler #17 - counting counting characters

I tried to tackle #17 problem on Project Euler: If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are \$3 + 3 + 5 + ...
ambitious_roi's user avatar
8 votes
1 answer
3k views

Dividing a number half into words and half number

Example: If I have a number 1000: I first put commas (In English Standard) that makes it: 1,000 I split the above at the first comma: I get 1 I convert 1 into words: I get One, name it ...
User3's user avatar
  • 261
5 votes
4 answers
2k views

Spelling a number in English

My Implementation: ...
Rezo Megrelidze's user avatar
6 votes
1 answer
3k views

Convert a number to text

This converts a "numerical number" to a text representation, for example: convert 1234 --> "One Thousand, Two Hundred Thirty Four" I'd like general feedback on how it could be make more readable ...
Carcigenicate's user avatar
6 votes
2 answers
2k views

Convert number into words

I am trying to implement a program which can convert number into words. My code can convert numbers between 0 - 999. It uses recursive function calls and simple arithmetic operations. Can you please ...
Mo Moallim's user avatar
10 votes
2 answers
940 views

Numbers to words converter

Please review my code: ...
Sajal Arora's user avatar
7 votes
2 answers
1k views

Convert numbers into a textual form

So this was originally inspired by @nhgrif's Int extension for translating integer to plain English, however the code is mainly a port of @rolfl's Converting a number to the text representation; ...
syb0rg's user avatar
  • 21.8k
13 votes
1 answer
296 views

Naming numbers in American English

This seems like a popular topic lately, so I took a crack at it. Related questions are Number to Words and Converting a number to the text representation. I used this article as a guideline. The ...
Dagg's user avatar
  • 4,531
8 votes
3 answers
7k views

Converting a number to the text representation

Following along with some previous questions: The @dbasnett original here: Number to Words @nhgrif's here: Int extension for translating integer to plain English I wanted to answer the original ...
rolfl's user avatar
  • 97.3k
15 votes
4 answers
3k views

Int extension for translating integer to plain English

This code was inspired by this question: Number to Words ...
nhgrif's user avatar
  • 25.2k
10 votes
2 answers
2k views

Number to Words

I have to convert positive numbers, that are less than 1000, to words. A quick search didn't find anything that looked good to my eye, so I came up with the following. While I was at it I expanded ...
dbasnett's user avatar
  • 371
15 votes
4 answers
2k views

Number to words in left to right direction

I have faced this question in an interview: If we enter a number it will convert into individual strings and display in same order. Ex: If I enter 564 then the ...
user3667402's user avatar
5 votes
2 answers
2k views

Numbers to Text Program - Python Training

I have written a numbers to text challenge for some people in my organisation to practice their Python skills. I am an economist working with pandas, but I am trying to teach them some stuff about ...
Woody Pride's user avatar
9 votes
3 answers
22k views

Number-to-word converter

My code works, but the aesthetic of the code seems to need some real work. The logic is simple enough: Create three lists of words that will be used throughout the conversion Create three functions: ...
WGS's user avatar
  • 193
5 votes
3 answers
2k views

Number to words problem

This is a very long solution I've been working on to a Number to Words problem. I've identified that there's a lot of repeating logic (e.g. 'if writing > 0', 'writing = integer /',). How would you ...
user avatar
8 votes
2 answers
14k views

Digit to words converter

This is one of the longest programs I have made with methods and I think I must be doing this rather inefficiently. Any comments to improve would be appreciated. ...
lukeb28's user avatar
  • 445
7 votes
5 answers
70k views

Convert number to words

I wrote this converter code. It can convert a number from 1-100 into words. It works perfectly, but it seems to be too complicated to me. Can you tell me whether it's okay or not? ...
mitya221's user avatar
  • 793
6 votes
2 answers
7k views

Writing the word equivalent of a check (cheque) amount

I am looking for feedback on a solution to the following problem posed from a book that I'm working through (Java: How To Program 9th Edition): Continuing the discussion in Exercise 16.20, we ...
cryptocurry's user avatar
3 votes
2 answers
178 views

Written numbers to numerical representation

So I took a stab at this task to begin learning common lisp. The idea is that you give it a written representation of a number such as "three thousand and forty nine" and it will output 3049. I was ...
Lerp's user avatar
  • 133
7 votes
2 answers
14k views

Converting an integer number into its word representation

I've written this code to convert an integer number into its word representation. I've tested it for many cases and it seems to be working as expected. For example: 1000 displayed as "One Thousand" ...
Phoenix's user avatar
  • 353
3 votes
1 answer
10k views

Convert number to words (web application)

I'm looking for a new job, and a company who had a role I was going for asked me to do a programming exercise. It consisted of making a web application of two or more pages that took a person's name ...
hopingtoimprove's user avatar

1
2