Multi-line String Constants

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
plumothy
Posts: 18
Joined: Mon Oct 25, 2010 8:24 pm

Multi-line String Constants

Post by plumothy »

I have TSILang on Delphi XE3, Windows 7 Professional

I would like to know how to get TsiLang to cope with strings that span multiple lines and which have carriage returns within them.

I have this code before scanning for strings:

Code: Select all

const
  crlf2 = #13#10#13#10;
  TestMultiLineString = 'Line 01' + crlf2 +
                        'Line 02';
After calling Const Section Without Form, I get this:

Code: Select all

	TestMultiLineString: string = 'Line 01' + crlf2 + // TSI: Localized (Don't modify!)
                        'Line 02';
So, the text returned by GetTextOrDefault('strTestMultiLineString') will only have the first line.

The example is trivial and the lines are short. I know I could join them all into a single line. But, in my real project I have many string constants that are long and contain several lines (and this is how they need to be displayed on the screen).

What is the correct way to deal with this situation please?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Just use #13#10 or ^M instead of crlf2. TsiLang Expert can't compile your units and detect the value of predefined constants, but if you will use #13#10 instead of crlf2 it will recognaize this as multiline constant.
Hope this helps.
Best regards,
Igor Siticov.
plumothy
Posts: 18
Joined: Mon Oct 25, 2010 8:24 pm

Post by plumothy »

isiticov wrote:Just use #13#10 or ^M instead of crlf2. TsiLang Expert can't compile your units and detect the value of predefined constants, but if you will use #13#10 instead of crlf2 it will recognaize this as multiline constant.
Hope this helps.
Ok - I can manage that. Thank you.
Post Reply