rcolyer.net
RC Lib  Version 202403231100
Public Member Functions | List of all members
RC::PluralStr Class Reference

Provides number-based singular/plural string management. More...

#include <RStr.h>

Public Member Functions

 PluralStr (const RStr &singular, const RStr &plural)
 Initialize with the singular and plural version of a string.
 
template<class T >
RStr For (T arg) const
 Provides the singular form if arg is 1, or the plural version otherwise.
 
template<class T >
RStr Count (T arg) const
 For any number arg, provides the number, followed by a space, followed by the correct singular or plural form.
 

Detailed Description

Provides number-based singular/plural string management.

Example usage: PluralStr cat("cat", "cats"); cout << cat.Count(5) << " plus one " << cat.For(1) << " is 6 " << cat.For(6); Produces: "5 cats plus one cat is 6 cats"


The documentation for this class was generated from the following file:
email address
— (c) 2015