Common Java Cookbook

Edition: 0.19

Download PDF or Read on Scribd

Download Examples (ZIP)

2.1. Setting Up StringUtils and WordUtils

2.1.1. Problem

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

2.1.2. Solution

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

2.1.3. 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.


Creative Commons License
Common Java Cookbook by Tim O'Brien is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.
Permissions beyond the scope of this license may be available at http://www.discursive.com/books/cjcook/reference/jakartackbk-PREFACE-1.html. Copyright 2009. Common Java Cookbook Chunked HTML Output. Some Rights Reserved.