Some examples of how you might use a TChoiceFormatter are:
Use TChoiceFormatter instances by nesting them within a TParameterFormatter instance. Create the TChoiceFormatter and then use the TParameterFormatter::SetParameterFormat member function to attach it to the appropriate segment in the text template.

You can also implement multiple levels of nested formatters for more complex message formatting.
Creating a TChoiceFormatter instance
To create and use a TChoiceFormatter instance:
TChoiceFormatter myChoiceFormatter;
myChoiceFormatter.SetChoice( TStandardText("is"), 1 );// if the variable = 1 use is
myChoiceFormatter.SetChoice( TStandardText("are") ); // use are for all other values
// Attach the TChoiceFormatter to parameter 1
myParameterFormatter.SetParameterFormat
(TTextRange( TTextOffset(19), TTextOffset(22)), 1, myChoiceFormatter );
// Use the same TChoiceFormatter to change "files" to "file"
myChoiceFormatter.ClearAllPatterns();
myChoiceFormatter.SetChoice( TStandardText("file"), 1 );
myChoiceFormatter.SetChoice( TStandardText("files") );
myParameterFormatter.SetParameterFormat
(TTextRange( TTextOffset(25), TTextOffset(30)), 1, myChoiceFormatter );
This example shows how to provide three options for the parameter formatter shown in "Creating a TParameterFormatter instance" on page 72, depending on the number of files:
myParameterFormatter.ClearParameterFormat(TTextRange( TTextOffset(19), TTextOffset(30) );
myChoiceFormatter.ClearAllPatterns();
myChoiceFormatter.SetChoice( TStandardText("aren't any files"), 0 );
myChoiceFormatter.SetChoice( TStandardText("is a single file"), 1 );
TParameterFormatter mySubMessage( TStandardText("are n files") );
mySubMessage.SetParameterType( 1, TStandardText("TFormattableNumber) );
mySubMessage.SetParameterFormat( TTextRange( TTextOffset(4), TTextOffset(5) ), 1,
myNumberFormat);
myChoiceFormatter.SetChoice(mySubMessage);
myParameterFormatter.SetParameterFormat( TTextRange(TTextOffset(19), TTextOffset(30)),
1,myChoiceFormatter);