Skip to main content

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
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.3k
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
13 votes
2 answers
31k views

Changing Number to Words in JavaScript

One day I saw a question on Stack Overflow asking about changing numbers to words, I thought about it, and next day I started coding. When I had the code working, I thought it could, most likely, be ...
bpbutti's user avatar
  • 233
9 votes
4 answers
1k views

Simple Number to Words using a Single Loop String Triplets in JavaScript

I have extensively reviewed 2 old articles on the subject: https://stackoverflow.com/questions/14766951/convert-digits-into-words-with-javascript and https://stackoverflow.com/questions/5529934/...
Mohsen Alyafei'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
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.4k
6 votes
3 answers
717 views

Very Simple Spell (Number to Words) 001 to 999 in VBA

I have come across many spell number functions and have reviewed many VBA code available on the net. The core function that gets called repeatedly is the function that converts numbers from 001 to ...
Mohsen Alyafei's user avatar
19 votes
4 answers
11k views

Converting a large number into something like: 4 Novemnongent

This is not a school project, just something to help me learn some Python! Just looking to see what I can improve on, looking for tips to reduce size & make it a bit easier for the computer to run ...
user155845's user avatar
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
13 votes
1 answer
300 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
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
7 votes
1 answer
3k views

Converting numbers to words in Haskell

Here's a program I wrote to convert numbers into English words using Haskell. ...
BrainFRZ's user avatar
  • 819
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
7 votes
1 answer
256 views

CtCI 16.8: Integer to English phrase in C++

I'm a C++ beginner working through Cracking the Coding Interview. This is question 16.8: Given any integer, print an English phrase that describes the integer (e.g., "One Thou­sand, Two Hundred ...
user avatar
5 votes
4 answers
2k views

Converting int values in Java to human readable strings in English

(See also the next iteration.) I have rolled this short program that converts int values to the human readable strings: ...
coderodde's user avatar
  • 29.1k
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
4 votes
2 answers
203 views

Simple Number to Words using a Single Loop String Triplets in VBA

As an update (conversion) to my article “Simple Number to Words using a Single Loop String Triplets in JavaScript” in JavaScript, I have converted the code to work as a VBA function using the same ...
Mohsen Alyafei's user avatar
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
2 votes
1 answer
305 views

Method to convert numbers into plain text

I'm relatively new to Java, and over the past week or so I've just been reading through the docs and messing around with it to better improve my understanding. As stated in the title, I've created a ...
user avatar
1 vote
4 answers
204 views

Spelling Java long values to human readable text in English

Now, I have extended my program taking some answers in the previous iteration into account: ...
coderodde's user avatar
  • 29.1k