CHAPTER 3 STRINGS AND REGULAR EXPRESSIONS

The previous chapter was concerned with numeric values and the basic arithmetic operations associated with them. In this chapter, we consider Strings—an ordered sequence of characters used to represent textual information. This information might represent the name for an individual or file. Equally, it may represent a bank account number or the name of a programming language. We give further details on using Strings and regular expressions for Appendix D.

3.1 STRING LITERALS

A String literal is readily constructed by enclosing the string text in quotations. Groovy offers a variety of ways to denote a String literal. For example, Strings in Groovy can be enclosed in single quotes ('), double quotes ...

Get Groovy Programming 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.