Jump to content
PeterPanettone

Converting a very long text to concatenated strings?

Recommended Posts

I have a very long HTML code text in the clipboard (<HTML>...</HTML>) without line-ends which I want to convert into a string constant in the Editor. If I use any of the GExperts string converters, I get the Compiler error message "Line too long". So how can I convert-split this very long clipboard string into concatenated strings of fixed maximal length suitable for a string constant, e.g.:

 

const MyHTML = '<HTML> ...' +
'...' +
'...' +
...
'...</HTML>';

 

Edited by PeterPanettone

Share this post


Link to post
1 hour ago, Der schöne Günther said:

This is exactly what the MultiPaste tool is for.

Not quite. The MultiPaste expects some text containing multiple lines.

Share this post


Link to post

Thanks for all the answers. I was hoping that an existing addon like GExperts or MMX would provide that feature. As it is very easy to write such a tool (and I am not a night worker), I will do it tomorrow.

Share this post


Link to post

I just wonder how do you get that text in your clipboard in the first place. Copy from another application (not from file on disk / http URL)?

Share this post


Link to post
10 hours ago, PeterPanettone said:

Thanks for all the answers. I was hoping that an existing addon like GExperts or MMX would provide that feature. As it is very easy to write such a tool (and I am not a night worker), I will do it tomorrow.

Another alternative might be to use a text editor that can format your HTML and add quotes (possibly with the help of regex)

Notepad++ https://notepad-plus-plus.org/downloads/

CudaText https://cudatext.github.io

TextEditorPro https://texteditor.pro

SublimeText https://www.sublimetext.com

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×