[Lazarus] IDE option: Convert selection to string ?

Michael Van Canneyt michael at freepascal.org
Thu Jul 12 14:19:14 CEST 2018


Hello,

The IDE contains a 'make resource string' refactoring option.

This requires the selection to be a pascal string.

However, I quite often find myself in the need to create a string constant
from arbitrary text:

I test an SQL statement in an SQL tool, and then I copy it to the pascal source
file where I need it. I must then manually convert it to a string constant
by adding the necessary quotes, doubling single quotes already there and 
appending +sLineBreak+ etc.

It would be nice if the IDE could do this:
select a block of text, and choose 'Refactoring -> convert to pascal string'

Currently I have a separate tool that does this (both ways: quote and unquote, 
in case I need to re-rest an SQL statement from my code) but it would be a lot 
faster if the IDE could do it for me. Most likely it already contains code
that does similar things like this.

I cannot imagine I am the only one with this need :)

Any chance of getting such a feature ?

Michael.







More information about the Lazarus mailing list