Forum Discussion

akuczkowski's avatar
akuczkowski
Contributor
11 years ago

Can you wrap a string to multiple lines without needing to explicitly combine the lines?

Question,



I want to be able to format a long string on multiple lines for readabilty and other reasons, is there a way to do something like this without have to close each line and explicitly concatenate the string?



Query := 'Select

                     ColumA,

                     ColumB,

                     ColumC,

                  From

                     Table

                  Where

                      ColumA = ''Something''

                  Order By

                       ColumC Asc';



I don't want to have to do



Query := 'Select ' +

                     'ColumA, ' +

                     'ColumB, ' +

                     'ColumC, ' +

                     etc.



We are using DelphiScript.



Thanks,

Adam

                        



  • Hello Adam

    You can use DelphiScript's special characters for this purpose:





    Query := 'Select'#13#10' ColumA,'#13#10' ColumB,'#13#10' ColumC,'#13#10'From'#13#10' Table'#13#10'Where'#13#10' ColumA = ''Something'''#13#10' Order By'#13#10' ColumC Asc';





    Yet in DelphiScript this will be much similar to concatenation (

  • Thanks but I was actually looking for something that made it more readable and editable in code and kept it easily transferable to a MySQL GUI client for use as well. Extra characters get in the way of both of those desires. Having to escape the single quote is also an annoyance in this situation as it invalidates the query in MySQL.



    Not a huge deal, just would be nice and I thought there might be something I wasn't aware of.