NimbleText 1.6, Codename Jetboat

Jetboat, the mildly anticipated new release of NimbleText is out now.

If you don't already use NimbleText every single day then you're missing out. NimbleText is a tool for manipulating little bits of data, for formatting text, for performing ad-hoc code generation. It's a versatile little tool that every programmer, DBA, sysadmin, knowledge worker and techie should keep within reach. Here's a two minute guide.


Download NimbleText


Here's a quick rundown of the new features:

Header Variables

You can now refer to the first row of the data from inside any row, using a '$h' pattern.

The new feature works like this. Say you have some simple data that includes a header row:

name, age
Jim, 126
Jenny, 4

Within your pattern you can refer to the first item in the header as $h0, and the second item as $h1, and so on. Like this:

Pattern:
$each+
The person with $h0 $0 has $h1 $1

The result will be:

The person with name Jim has age 126
The person with name Jenny has age 4

This basically means you can stash 'global variables' into the first row and access them in your pattern. Which means you can reuse your patterns more often.

Counting from the right.

Sometimes the data you are parsing is 'jagged' meaning different rows have a different number of columns. This can happen for a variety of reasons. In NimbleText we can't pick and choose the data we are handed. We just do our best to handle for what we get.

When you have jagged data, you often want to read the last column, or the second last column: basically you want to count the columns starting from the left. For example, here's some sporting data:

Name, Scores (ascending)
Stu, 0, 0, 1
Jim, 1, 2, 2, 3, 8  
Stacey, 0, 0, 1, 3, 3, 9, 9

Notice there is a different number of scores for each player. If you only want the last score you can use a negative index to count from the right:

$each+
The best score for $0 is $-0

Returns:

The best score for Stu is 1
The best score for Jim is 8
The best score for Stacey is 9

Download it now, or use the online version.

Release notes are here.

 

I'm currently writing a book about how to build your first product. If building a product is something you'd like to do, then sign up to be notified when the book is available.

Your comment, please?

Your Name
Your Url (optional)
Note: I may edit, reuse or delete your comment. Don't be mean.