2.1. Setting Up StringUtils and WordUtils

Problem

You want the ability to use StringUtils and WordUtils to manipulate text.

Solution

To download the latest version of Commons Lang, refer to the steps outlined in Recipe 1.1.

Discussion

This chapter focuses on a very small subset of the Commons Lang project—StringUtils and WordUtils. To use either StringUtils or WordUtils in a Java class, add the following lines to your import statements:

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils;

Recipes that use StringUtils and WordUtils in this chapter will omit these import statements in code fragments. When StringUtils or WordUtils appears in an example, assume that it has already been imported.

See Also

If you have questions about these utilities, join the Jakarta Commons User mailing list; see Recipe 1.2. To download the source for Commons Lang, see Recipe 1.3.

Get Jakarta Commons Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.