# Word with an 'S' if quantity \> 1

**URL:** <https://www.ruby-forum.com/t/word-with-an-s-if-quantity-1/160687>\
**Category:** Ruby\
**Created:** [February 18, 2009, 8:29pm UTC](https://www.ruby-forum.com/t/word-with-an-s-if-quantity-1/160687 "2009-02-18T20:29:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![loader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5daacb/32.png) [@loader](https://www.ruby-forum.com/u/loader)\
**Post date:** [February 18, 2009, 8:29pm UTC](https://www.ruby-forum.com/t/word-with-an-s-if-quantity-1/160687/1 "2009-02-18T20:29:34Z")

</div>

Hello everyone!

Is there a method to add an ‘S’ to a word if there are more than 1 ?

For example : 1 day / 2 days …

Or do I need to create an if statement?

Thank you!

---

<div class="post-metadata">

**Author:** ![loader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5daacb/32.png) [@loader](https://www.ruby-forum.com/u/loader)\
**Post date:** [February 18, 2009, 8:40pm UTC](https://www.ruby-forum.com/t/word-with-an-s-if-quantity-1/160687/2 "2009-02-18T20:40:35Z")

</div>

On Feb 18, 1:29 pm, Guillaume L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Posted viahttp://www.ruby-forum.com/.  
> try String#pluralize from the active\_support gem

---

<div class="post-metadata">

**Author:** ![loader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5daacb/32.png) [@loader](https://www.ruby-forum.com/u/loader)\
**Post date:** [February 18, 2009, 9:01pm UTC](https://www.ruby-forum.com/t/word-with-an-s-if-quantity-1/160687/3 "2009-02-18T21:01:07Z")

</div>

On Feb 18, 2009, at 2:39 PM, snex wrote:

> > –  
> > Posted viahttp://www.ruby-forum.com/.
> 
> try String#pluralize from the active\_support gem

Or roll your own if you have a simple need:

3.times do |n|  
puts “call me in #{n} day#{‘s’ unless n==1}”  
end  
call me in 0 days  
call me in 1 day  
call me in 2 days  
=\> 3

But if you don’t know the noun that you’ll be counting (‘day’), then  
the Inflector from ActiveSupport is the way to go. (snex’s  
recommendation of String#pluralize uses the Inflector internally).

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![loader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5daacb/32.png) [@loader](https://www.ruby-forum.com/u/loader)\
**Post date:** [February 18, 2009, 10:42pm UTC](https://www.ruby-forum.com/t/word-with-an-s-if-quantity-1/160687/4 "2009-02-18T22:42:06Z")

</div>

I used your code Rob and it works fine! Thanks 🙂
