Books / Patterns for Beginning Programmers / Chapter 25
Part V - Patterns Requiring Knowledge of String Objects
Part V contains programming patterns that require an understanding of
String
objects. Specifically, this part of the book contains the
following programming patterns:
Centering. Solutions to problems that involve the centering of content (of various kinds) in containers (of various kinds).
Delimiting Strings. Solutions to problems that are similar to the problem of inserting commas between the words in a list.
Dynamic Formatting. A solution to problems that require the format
of a String
to be determined dynamically (i.e., at run-time rather
than at compile-time).
Pluralization. A solution to the problem of creating both regular and irregular pluralizations.
The first three patterns in this part of the book all use an accumulator and some other logic to solve their associated problems. The pluralization pattern is really nothing more than a clever use of methods.