What is the specific tool, I language organization for a long time still feel not good enough, or to tell you a few pictures to achieve an effect and how to use it. Supplement: Under real circumstances, I will copy the strings that need to be spliced in the project into 1.txt at one time, draw a line to distinguish them, and go to answer.txt to get the required part when using
Add: Because I have been doing web app and wechat a lot recently, a lot of syntax of ES6 is always wrong on Android machine, I have no time to see which syntax is recognized by Android machine, so for the sake of safety and efficiency, I will not use es6 related syntax. There is also the conversion of ES6 to ES5 via Babel. I have been too lazy to learn before, so I can’t steal this laziness, nice.
rendering
Situation: Xiao Ming is a graph cutter. one day, he finished cutting all the graphs to prepare data docking. The list page code is shown in Figure 1.
Ming likes to be lazy, so he has wrapped up a pull-down refresh and pull-up plug-in, and everything is ready, just need to concatenate string and real data in callback. However, this project has so many list pages, so many times to add single quotes and plus signs is too hard to read. As a result, Ming easily completed the part with single quotation marks and plus signs through a few lines of Node.js code, as shown in Figure 2.
How to do that?
Xiao Ming is a front-end image cutting boy, is not familiar with the language of the background, want to read files, edit files, and then write files to think about through Node.js. The implementation process made many mistakes and failed several times. For example, readline is used to read the Chinese characters line by line, but there is no way to parse the Chinese characters. Finally, we found a way to parse Chinese, read it with binary code and then decode it with GBK. The server.js code is shown in Figure 3.
How to use it?
The way to use it is very simple. First, the environment is to download and install Node.js, which requires fs and IconV-Lite.
The first step is to copy the strings you want to process into 1.txt
Second, execute the Node Server statement in this directory
Step 3: Open the generated answer.txt to copy the code.
summary
For beginners who move bricks all day, I think this tool can save a lot of time. In the process of writing, since I was new to Node and focused on implementation, I didn’t think much about it, and I was thinking about identifying the newline loop that took a little time. Reference = only to those who really need it. =, I use it a lot. If it helps you, give it a thumbs up!