TextFinder library for parsing Ethernet or Serial

A library named TextFinder has been added to the playground that enables extracting information from a stream of data. It was created to be used with the Arduino Ethernet library to find particular fields and get strings or numeric values. I can also be used with Serial data.

To use TextFinder, you create an 'instance' for the stream you want to processes. For example, the following fragment is based on the Ethernet client example sketch distributed with Arduino. That sketch does a google search on the term arduino. The following adds functionality to print the number of hits reported by google.

Add these lines before setup:
#include <TextFinder.h>
TextFinder finder( client );

Modify the connection code as follows:
if (client.connected())
finder.find("Results "); // seek to the Results field
finder.find("of about "); // skip past this
long value = finder.getValue(); // get numeric value
Serial.println(" hits");

The remainder of the sketch can be as in the distributed example. The find method reads data from the client until it finds the string: "Results "
It then looks for the string: "of about "
And the getValue method returns the next numeric value.

See the playground for more details: Arduino Playground - TextFinder

That looks potentially very usefull.