1

I would like to have a function like std::string toPlural(const std::string&), that converts a given noun to plural form, like form->forms, vertex->vertices, etc. I'm interested in English only.

I understand that it is relatively easy to write, but

  1. Writing code is actually a worst thing I can do as a software developer
  2. I'm not a native English speaker, so it would require some research
  3. English has many exceptions for plurals, like tooth->teeth, mouse->mice, etc. Don't want to hard-code them, don't want to add a new resource with these to the program, don't want to unit-test all of them, you know.

Is there some 3rd-party library I can use?

  • for number 3 - are you ok if the library does this. You can check ICU it is extremely heavy library that seems is not what you looking for - but it solves most of such problems - for many languages. – gsf Jan 2 '16 at 18:49
  • @gsf Yeah, this seems like an overkill, but maybe we will need some other of its functionality. Thanks for the link. – Mikhail Jan 4 '16 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.