SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Multi-line String Constants

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
plumothy



Joined: 25 Oct 2010
Posts: 13

PostPosted: Fri May 17, 2013 10:21 am    Post subject: Multi-line String Constants Reply with quote

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:
const
  crlf2 = #13#10#13#10;
  TestMultiLineString = 'Line 01' + crlf2 +
                        'Line 02';


After calling Const Section Without Form, I get this:

Code:
   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?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Fri May 17, 2013 10:35 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
plumothy



Joined: 25 Oct 2010
Posts: 13

PostPosted: Fri May 17, 2013 12:41 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group