O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Searching in a file

In this recipe, we demonstrate how to search for certain words in a text file. You can find the code in the search.dart script in the project searching_file. As an example text file, we use taoprog.txt.

How to do it...

The program is launched from the command-line in the bin folder (or in Dart Editor with a Managed Launch with Script argum ents -n search1 search2taoprog.txt) as shown in the following screenshot:

How to do it...

In dart searc h.dart -n search1 search2 taoprog.txt , where search1 and search2 are words to be searched for, there can be one or more search words. For example, let's search for mysterious and machine, in which case, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required