Turn a word into singular form

string:singularize(STRING word
, INT count: 1) : STRING

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

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

string:singularize('men', 1)         
#=> "man"

string:singularize('men', 2)         
#=> "men"

# if you provide a sentence it will singularize the last word
string:singularize('friends computers fans')
#=> "friends computers fan"

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

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