* * *

Author Topic: Multiple lines strings?  (Read 348 times)

Ricardo T.

  • New member
  • *
  • Posts: 11
Multiple lines strings?
« on: October 17, 2018, 07:57:23 am »
Hello u all... Hope everyone is doing ok...  ;)

How to write a multiple line string in the constant section without messing up the indentation in the code?

Like in Python you can do a triple quote string """.......""" that can be several lines in length.Can i do something similar in FPC?

Do i also have to declare it as an Ansistring?

Thanks...

Handoko

  • Hero Member
  • *****
  • Posts: 2631
  • My goal: build my own game engine using Lazarus
Re: Multiple lines strings?
« Reply #1 on: October 17, 2018, 08:30:55 am »
Code: Pascal  [Select]
  1. const
  2.   S = 'Good Morning everyone.'       + LineEnding +
  3.       'Welcome to the Pascal forum!' + LineEnding +
  4.       'Here you will meet many nice people.';

Read more about LineEnding:
http://wiki.freepascal.org/End_of_Line

Note:
Pascal is not strict about indentation. The code above can be rewrited as:
Code: Pascal  [Select]
  1. const
  2.   Something = 'Good Morning everyone.' + LineEnding +
  3.     'Welcome to the Pascal forum!' + LineEnding +
  4.     'Here you will meet many nice people.';
« Last Edit: October 17, 2018, 08:43:03 am by Handoko »

Ricardo T.

  • New member
  • *
  • Posts: 11
Re: Multiple lines strings?
« Reply #2 on: October 17, 2018, 09:22:04 am »
Handoko... Thank U Sir.  I will give it a try...  :D

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus