The Developer Tool You Can't Live Without
Tags: productivity, beginners, webdev, programming
Published: 2020-01-11 16:59:32

---
title: The Developer Tool You Can't Live Without
published: true
description: I'm introducing a text/code generation tool that you will fall in love with. If you're a developer or someone who works with text or tabulated data you need this tool.
tags: productivity, beginners,webdev,programming
canonical_url: https://www.jeremymorgan.com/blog/programming/tools-csv-text-nimbletext/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/3848ngvi25zgjhbyz6uk.jpg
---

I'm introducing a text/code generation tool that you will fall in love with. If you're a developer or someone who works with text or tabulated data you **need** this tool. 

It's called [Nimble Text](http://bit.ly/NimbleText) and it's awesome. Here's how the developer of Nimble Text describes it:

>You can be more awesome at your job by keeping this tool always within reach.
>
>NimbleText is a text manipulation and code generation tool available online or as a free download. It magnifies your ability to perform incredible feats of text and data wrangling.

So it's a bold claim to say this will make you better at your job. Sounds crazy right? 

I have been using this for years (since 2011-2012) and I can tell it's certainly made me more effective. 
  
Download it and follow along. 

## How Nimble Text Works

![Nimble Text](https://thepracticaldev.s3.amazonaws.com/i/qnbkfoyhdstewp6vszan.jpg)
  
If you look at the screen that comes up when you first run it, you can get a really good idea of how it works.   
  
You paste in some data, usually in columns and rows (Comma, tab-separated, etc.)
You put in your pattern ($0, $1, etc represents the columns)
For each row of data, it will substitute the values and display the results. 

in the sample above, you can see rows of data that appear to be last name, first name, company name.   
  
So let's look at the top row. In our substitution pattern, we're creating an email and it shows $1 (2nd column, starts at 0) which we know is a first name. Then we have a period, and then $0 which we know is the last name, then @ $2 .com which we assume will make Initech.com.   
  
One of the coolest parts of this is that the pattern doesn't need to be line by line and you don't need to be a Regex expert to do this.   
  
Here's another example of how you can quickly add quotes around CSV values. This is using data from [Mockaroo](http://bit.ly/Mockaroo). 

So we take this CSV file and dump it in the input:

![Nimble Text](https://thepracticaldev.s3.amazonaws.com/i/9tnub22ktgxadrva47vx.jpg)

Then we use this simple pattern, which puts quotes around all the values:

![Nimble Text](https://thepracticaldev.s3.amazonaws.com/i/iyocqx8iv4ekxl8sa2zh.jpg)

We press generate, and get this: 

![Nimble Text](https://thepracticaldev.s3.amazonaws.com/i/0b3pob6989imwt1gl3ee.jpg)
  
It's that easy! But this is isn't really impressive, because you probably aren't doing a ton of CSV format conversions on a daily basis. But there's a lot of potential here. 

## How I Use This as a Developer

So there are tons of things you can do with this that are [explained on their website](http://bit.ly/2FAAbSm). You can do cool things like [remove leading trailing and leading spaces](http://bit.ly/2NgY6dN) or convert [spaces to tabs](http://bit.ly/2FBxC2s). I love using things like [converting to Camel Case](http://bit.ly/39XYZSm) and I've done weird stuff with [Base64 encoding](http://bit.ly/37WqU3m).

I won't repeat what's already been written there. I'll tell you how *I've been using it* all these years. 

Let's take our sample data set: 

![Nimble Text](https://thepracticaldev.s3.amazonaws.com/i/9tnub22ktgxadrva47vx.jpg)

And we'll see what we can do with it. 

### Create JSON

Let's say I want to make JSON out of this. I would put in a pattern like this:

```
{
  "id": $0,
  "first_name": "$1",
  "last_name": "$2",
  "email": "$3",
  "gender": "$4",
  "ip_address": "$5"
}
```
  
Nimbletext then prints this out: 

![Nimble Text](https://thepracticaldev.s3.amazonaws.com/i/q5ia24iz6f3aokr0eknf.jpg)

and it will repeat for every row of data. Very cool, and easy.

### Make some objects 

So as a C# Developer sometimes I'd generate fake data and then use it for Unit testing. With our sample data, I would create a class like this: 

```csharp
public class Person
{
    public string Name { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Email { get; set; }
    public string Gender { get; set; }
    public string IPAddress { get; set; }
}
```
  
Then, let's say I want to create a collection of these objects. I then enter a pattern like this into Nimble Text:   
 
```
new Person { Id = $0, FirstName = "$1", LastName = "$2", Email = "$3", Gender = "$4", IPAddress = "$5" },
```

Then, I click "calculate" and get this:

![Nimble Text](https://thepracticaldev.s3.amazonaws.com/i/y2w1lxpoy2af3qesu5eh.jpg)

Which generates a nice set of mocked objects for testing: 

```csharp
List<Person> people = new List<Person>
{
    new Person { Id = 1, FirstName = "Derick", LastName = "Giorgietto", Email = "dgiorgietto0@freewebs.com", Gender = "Male", IPAddress = "193.214.16.47" },
    new Person { Id = 2, FirstName = "Jorey", LastName = "Bertomieu", Email = "jbertomieu1@pcworld.com", Gender = "Female", IPAddress = "228.52.120.198" },
    new Person { Id = 3, FirstName = "Jordana", LastName = "Ofield", Email = "jofield2@mashable.com", Gender = "Female", IPAddress = "242.56.206.162" },
    new Person { Id = 4, FirstName = "Zelda", LastName = "Pett", Email = "zpett3@google.nl", Gender = "Female", IPAddress = "53.184.3.220" },
    new Person { Id = 5, FirstName = "Malia", LastName = "McCuffie", Email = "mmccuffie4@noaa.gov", Gender = "Female", IPAddress = "100.137.97.15" },
    new Person { Id = 6, FirstName = "Juliet", LastName = "Sivior", Email = "jsivior5@scientificamerican.com", Gender = "Female", IPAddress = "77.243.6.34" },
    new Person { Id = 7, FirstName = "Trista", LastName = "Filde", Email = "tfilde6@narod.ru", Gender = "Female", IPAddress = "24.158.23.9" },
    new Person { Id = 8, FirstName = "Bartlet", LastName = "Pankhurst.", Email = "bpankhurst7@cmu.edu", Gender = "Male", IPAddress = "61.253.135.113" },
    new Person { Id = 9, FirstName = "Giorgi", LastName = "Verbeke", Email = "gverbeke8@utexas.edu", Gender = "Male", IPAddress = "2.43.176.188" },
    new Person { Id = 10, FirstName = "Issy", LastName = "Ramplee", Email = "iramplee9@com.com", Gender = "Female", IPAddress = "53.253.248.96" }  
};
```

I have done this countless times over the years. Once you get it into your regular workflow, mocking up data takes seconds.   
  
### SQL Statements

You can even make SQL statements like this: 

Pattern:   
```
$ONCEINSERT INTO Person (id, first_name, last_name, email, gender, ip_address) VALUES
$EACH($0, "$1", "$2", "$3", "$4", "$5"),
```
The $ONCE variable prints the first statement, then $EACH loops through after that. So you get this in return:

```sql
INSERT INTO Person (id, first_name, last_name, email, gender, ip_address) VALUES 
(1, "Derick", "Giorgietto", "dgiorgietto0@freewebs.com", "Male", "193.214.16.47"),
(2, "Jorey", "Bertomieu", "jbertomieu1@pcworld.com", "Female", "228.52.120.198"),
(3, "Jordana", "Ofield", "jofield2@mashable.com", "Female", "242.56.206.162"),
(4, "Zelda", "Pett", "zpett3@google.nl", "Female", "53.184.3.220"),
(5, "Malia", "McCuffie", "mmccuffie4@noaa.gov", "Female", "100.137.97.15"),
(6, "Juliet", "Sivior", "jsivior5@scientificamerican.com", "Female", "77.243.6.34"),
(7, "Trista", "Filde", "tfilde6@narod.ru", "Female", "24.158.23.9"),
(8, "Bartlet", "Pankhurst.", "bpankhurst7@cmu.edu", "Male", "61.253.135.113"),
(9, "Giorgi", "Verbeke", "gverbeke8@utexas.edu", "Male", "2.43.176.188"),
(10, "Issy", "Ramplee", "iramplee9@com.com", "Female", "53.253.248.96")
```

Easy as pie! Anything you can do with JavaScript you can do with Nimble Text. 

### HTML Tables

So this is odd but something I've had to do in the past, and Nimble Text works great for it. Here's how you create an HTML table for our sample data:   
  
```
$ONCE<table>
$ONCE    <tr><th>ID</th><th>First Name</th><th>Last Name</th><th>Email</th><th>Gender</th><th>IP Address</th></tr>
$EACH    <tr><td>$0</td><td>$1</td><td>$2</td><td>$3</td><td>$4</td><td>$5</td></tr>
$ONCE</table>
```

Click generate and there it is:   

![Nimble Text](https://thepracticaldev.s3.amazonaws.com/i/q2xoqmxgckjy7rhhns57.jpg)

A usable HTML table!!

## Conclusion

This tool will help you become a better, more effective developer. You can use it for all kinds of code generation. I've done some crazy things with the [Keywords](http://bit.ly/2R8qeAP) and [Functions](http://bit.ly/2QGShbA) in this program. You can write code to generate code. 
  
I've seen the most benefit with time savings. Things like mocking data or processing CSVs are boring and tedious. When you're doing boring tedious things you make mistakes. So once you work this tool into your workflow you'll work faster with fewer mistakes.   
  
Once it becomes a part of your routine you won't want to work without it.   
  
[Download](http://bit.ly/NimbleText) it, try it out, and **[let me know what you think!](http://bit.ly/JeremyCMorgan)** 

If you want to learn how to reduce complexity in data, [check out this course](https://www.pluralsight.com/courses/reducing-complexity-data). It covers several techniques for optimizing data.