From the course: Learning Groovy

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Processing file contents

Solution: Processing file contents - Groovy Tutorial

From the course: Learning Groovy

Start my 1-month free trial

Solution: Processing file contents

(upbeat music) - [Instructor] Let's talk about the solution for this challenge. I will guide you through the functionalities step by step. You can find the complete solution in your exercise folder, but feel free to download and enhance the code even more. Before starting to write any code, let's first have a brief look at the resources directory containing the text files we'll want to read. So you can see here in this directory, we have two different files, balances.text and years.text. If you open up one of those, you can see has multiple lines, some of which are numbers and some of which are just words. So basically plain text. We will only want to actually read the numbers contained in these text files. So let's go back to our main method here and instead of writing code directly in the main method, we'll actually start by creating a new method, which will contain all the code that is supposed to read the text…

Contents