Back to test list

Pluralise Tests

The pluralise function replaces $ at the end of a word following a number. If the number is 1, it removes the $. Otherwise, it replaces it with s.

InputOutput
"1 employee$""1 employee"
"2 employee$""2 employees"
"1 employee$ vs 2 employee$""1 employee vs 2 employees"
"0 employee$""0 employees"
"1.5 employee$""1.5 employees"
"1,000 employee$""1,000 employees"
"No employees here!""No employees here!"
"10 apple$ and 1 pear$""10 apples and 1 pear"
"1 banana$, 2 banana$, 3 banana$""1 banana, 2 bananas, 3 bananas"
"123 apple$ and 1 pear$""123 apples and 1 pear"
"22 apple$ 1 pear$""22 apples 1 pear"
"123.456 apple$""123.456 apples"
"1,234,567 apple$""1,234,567 apples"

Dynamic Test

Result: "I have 1 apple and 2 oranges"