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.


Icon for the Creative Commons Attribution 4.0 International License

Patterns for Beginning Programmers Copyright © 2022 by David Bernstein is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book