Recent

Author Topic: VariabilesType How to enables inside IDE, the multiples lines inside oneString?  (Read 2448 times)

d2010

  • Sr. Member
  • ****
  • Posts: 264
Hello
Code: Pascal  [Select][+][-]
  1. {--}
  2. Function coexeicoane_asciiart5(link:boolean):shortstring;
  3. Begin
  4.      if (cntAssert08one in[31278,32795]) then else
  5. Result:=
  6. '___ _ _        _     ~~~       ~~~  _
  7. |_ _| (_) ___  | |    __ _  ___ __ _| |_ _   _ ___ _   _
  8. | || | |/ _ \ | |   / _` |/ __/ _` | __| | | / __| | | |
  9. | || | |  __/ | |__| (_| | (_| (_| | |_| |_| \__ \ |_| |
  10. |___|_|_|\___| |_____\__,_|\___\__,_|\__|\__,_|___/\__,_|
  11. ';    
  12.  

My Error
C:Q1= How to fix, the  " coexeico.lpr(205,1) Error: String exceeds line?"

BildatBoffin

  • Jr. Member
  • **
  • Posts: 51
"We dont have multi-line string literals yet" might explain the error ? Just split each line and use '+' to concatenate.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12429
  • Debugger - SynEdit - and more
    • wiki
Actually, FPC 3.3.1 (very latest main branch from git) has it (but you need multiple ' or a ` depending on mode...).


Also your
Quote
Code: Pascal  [Select][+][-]
  1. in[31278,32795]
That does not work.

"in" is a set operator. It only works with values from 0 to 255. (Compile with range check)

Joanna

  • Hero Member
  • *****
  • Posts: 1461
Hello
Code: Pascal  [Select][+][-]
  1. {--}
  2. Function coexeicoane_asciiart5(link:boolean):shortstring;
  3. Begin
  4.      if (cntAssert08one in[31278,32795]) then else
  5. Result:=
  6. '___ _ _        _     ~~~       ~~~  _
  7. |_ _| (_) ___  | |    __ _  ___ __ _| |_ _   _ ___ _   _
  8. | || | |/ _ \ | |   / _` |/ __/ _` | __| | | / __| | | |
  9. | || | |  __/ | |__| (_| | (_| (_| | |_| |_| \__ \ |_| |
  10. |___|_|_|\___| |_____\__,_|\___\__,_|\__|\__,_|___/\__,_|
  11. ';    
  12.  

My Error
C:Q1= How to fix, the  " coexeico.lpr(205,1) Error: String exceeds line?"
Put the text of each line in quotes and insert
+lineending+ at the places where you want to make new line.

n7800

  • Hero Member
  • *****
  • Posts: 710
  • Lazarus IDE contributor
    • GitLab profile
Right-click in the Source Editor and select "MultiPaste..." from the context menu. This window will help add quotes and line endings for each line.

Thaddy

  • Hero Member
  • *****
  • Posts: 19268
  • Glad to be alive.
It is enough to change the start end back ticks with triple normal ticks '''.
That's because your ascii art contains back ticks.
Also choode a fixed font:
Code: Pascal  [Select][+][-]
  1. memo1.lines.add(
  2. '''
  3. __ _ _        _     ~~~       ~~~  _
  4. |_ _| (_) ___  | |    __ _  ___ __ _| |_ _   _ ___ _   _
  5. | || | |/ _ \ | |   / _` |/ __/ _` | __| | | / __| | | |
  6. | || | |  __/ | |__| (_| | (_| (_| | |_| |_| \__ \ |_| |
  7. |___|_|_|\___| |_____\__,_|\___\__,_|\__|\__,_|___/\__,_|
  8. '''
  9. );
I used consolas font to test.
Still needs a VERY recent trunk. days or weeks, not months old.

It is also possible to use uneven multiple - uneven! - repeats to escape duplicates in your original "text", just like normal quote- escapes.
This very new feature can of course have minor glitches. I prefer the Delphi mode '''....''', not the back-ticks.
« Last Edit: August 19, 2025, 06:12:14 pm by Thaddy »
objects are fine constructs. You can even initialize them with constructors.

 

TinyPortal © 2005-2018