Chapter 5Working with Strings

We all know it’s a pain to work with strings in Java. As fundamental as strings are in programming, we would think it would be easier. But no, it takes effort to do basic string manipulation, to evaluate multiple variables or expressions into a string representation, and even to do something as simple as create a string that spans multiple lines. Groovy to the rescue! Groovy takes away the pain of dealing with strings on these fronts. It also makes pattern-matching of strings with regular expressions much easier by providing special operators. We’ll go through the basics of Groovy strings in this chapter.

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