What's missing from Phobos for Orbit (package manager)

Jonathan M Davis jmdavisProg at gmx.com
Tue Feb 12 10:22:29 PST 2013


On Tuesday, February 12, 2013 09:21:08 Steven Schveighoffer wrote:
> > * pluralize - Takes a string and a count. If the count is greater than 1
> > it converts the word in the string to plural
> 
> basic version:
> string pluralize(string x, int count)
> {
> return count > 1 ? x ~ "s" : x;
> }
> 
> Now, you probably would need a simple mechanism to do the different plural
> forms. Sometimes 'es' must be added, sometimes 'y' must be changed to
> 'ies', etc. But that should be a simple switch statement. The switch
> statement would select a different ending, and a prefix count based on the
> current ending.

Actually, given that that's English-specific, I don't know that we'd actually 
want that. I think that we do have a few English-specific items in Phobos, but 
for the most part, that really belongs in internationalization of some 
variety. But maybe it would be okay to add. If not, given how simple it is, if 
Orbit really needs it, I wouldn't think that it would be a big deal for it to 
just include it internally.

- Jonathan M Davis


More information about the Digitalmars-d mailing list