Skip to content

Arduino StrScanner

This library was made in order to solve a simple problem - traversing the contents of a String in a CSV format (or similar) - with few lines of code in an environment where every byte of memory matters, Arduino.

Coming from Java programming I remembered of the useful class Scanner, which offered pretty good functionalities in analyzing CSV inputs, so I decided to replicate that mechanism.

Base usage

The basic usage is pretty simple, the basic functions you need are

  • hasNext()
  • next()

The first one tells you if there is another element ready to be read, and the second one returns that element and proceeds to analyse the next one (if it exists).

String myString = "element1;element2;element3";
StrScanner scanner(myString, ";");

while (scanner.hasNext())

If you need the result in other forms, you can call the other variants

  • nextInt, that returns an integer
  • nextBool, a boolean
  • nextDouble
  • nextByte

If you want more, the complete documentation can be found in the StrScanner Wiki pages, along with a lot of sample codes and usage suggestions.


Current library version is: 0-BETA

You can download the library here, or if you wish to contribute, the repository on Bitbucket is open at this address: