Turn a word into plural form

string:pluralize(STRING $word, INT $count=2) : STRING

string:pluralize('building')
#=> "buildings"

string:pluralize('man')         
#=> "men"

string:pluralize('person')
#=> "people"

string:pluralize('MAN')         
#=> "Men"

string:pluralize('user', 1)
#=> "user"

string:pluralize('user', 2)
#=> "users"

string:pluralize('user', 0)
#=> "user"

# if you provide a sentence it will pluralize the last word
string:pluralize('good morning my friend')
#=> "good morning my friends"

# empty string will be returned as is
string:pluralize('')
#=> ""

Copyright ©2013-2022 SunSed®. All rights reserved.