NimbleText – Data processing tool to manipulate text that conform to a specific structure

Sometimes when you need to import data, you may receive an email list. This email list needs to be imported into the DB. If the imported SQL syntax is generated, what should you do?

If there are only 10 emails in this email list, the hand-carved sql grammar problem is not too big, but what if there are 1000 emails?

In another situation that is more related to program development, suppose SA opens a list to tell you what properties this class needs. How to quickly generate this property?

In this article, I will introduce how to use NimbleText as a tool to quickly meet the requirements of the above two scenarios.

Introduction to NimbleText

NimbleText Small File

The description given to him by the author of the NimbleText tool is: Manipulate text and data with light-weight patterns .

animation showing use of NimbleText for generating SQL Insert statements

To put it simply, it is to generate content according to the template defined by the list data.

It still sounds a bit abstract, but it will be clearer when there are examples.

version difference

NimbleText is available in 3 versions:

  1. Live – online version
  2. Desktop – Application Edition
  3. Desktop + License – App version plus purchase license

This tool is very Buddhist. Basically, both Live and Desktop are free, and a license is only required for advanced functions. In my current use, Live is actually quite enough.

NimbleText Feature Checklist

Introduction

The Live version will be introduced here .

The whole picture has 3 parts:

  1. For each row in the list : each data to be processed
  2. Substitute using this pattern : the content of the template
  3. Result : the last generated result
animation showing use of NimbleText for generating SQL Insert statements

In the right part of “Result”, you can set each data:

  1. column separator : cutting words
  2. row separtor : line break
  3. insert : pre-existing template

The easiest way to use it is:

  1. Throw the data to be processed intoFor each row in the list
  2. A template for Subsitute using this patternadjusting results. You can use $0to represent the first cut column, and so on
  3. copying Resultthe final result

Use scenario 1 – generate insert sql syntax according to the list

This scenario is that there is a list that is part of the value of insert, for example, an insert sql syntax should be generated for each email.

Suppose, the obtained list is as follows:

[email protected]
[email protected]
[email protected]

None

The last sql syntax to be imported is to go to the fields EpaperSubscribein the table :email

INSERT INTO EpaperSubscribe (email)
VALUES ('$0');

None

Finally, you can Resultcopy it out and execute it in SSMS.

Use scenario 2 – Generate a class property

Assuming that SA has opened all the property names and forms in the class, how to quickly generate these properties?

Assume that the list of property types and names obtained is as follows:

int Id
string Name
DateTime CREATEDATE

None

The property to be generated is a public version including get and set, and the template will be:

public $0  <% $1.toPascalCase() %> { get; set;}
            

NoneNotice here that the name of the last field is 

all uppercase , but the property name that conforms to the C# naming rules can be created through the function of NimbleText.If you want to create a property including private variable, you can choose it from the template as a reference.For the example above to be successful, remember to change 

the column separator 

to blank .

The final result is directly pasted into the C# class.

End Notes

If there is no NimbleText to achieve the above functions, it is generally generated using a combination similar to RegEx, but it is actually not easy to write.

By using NimbleText, the whole operation becomes very simple, and by recording these patterns, the same data structure can produce the required results at any time.

If you have better tools and practices, please leave a message to me.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.