IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#51425 - 04/22/15 04:34 AM Add CRLF to string
Eric Jourdan Offline
OL Newbie

Registered: 04/22/15
Posts: 1
Loc: DE, Bretten
I tried to add an crlf to an existing string.
I need to create an adressfiled with different information from an xml. I tried to use an if-statement to locate the existing information an add them to an locale variable which i tried to print that on my page.
Here is teh code i tried to use
Click to reveal..

if(&an_name1 <> '')
&an_namen:=&an_name1
endif()
if(&an_name2 = '')
&an_namen:=&an_namen + '\013\010' + '2.Zeile' + &an_name2
endif()
if(&an_name3 = '')
&an_namen:=&an_namen + '\010' + char(10) + '3.Zeile' + &an_name3
endif()

I tried different

  • char(13)+char(10)
  • '\013\010'
  • crlf() <- which braught me an error, because you can use it only in show()


The support told me to use '\013\010' wont work.
The support told me to use char(13)+char(10), same frown

Top
#51426 - 04/22/15 07:38 AM Re: Add CRLF to string [Re: Eric Jourdan]
Jeff_K
Unregistered


Eric,
First:
\015\012 is Octal. char(0D)+char(0A) is ASCII. The two have different values so this is significant.
http://help.objectiflune.com/en/planetpress-design-user-guide/Default_CSH.html#/3125.html
http://help.objectiflune.com/en/planetpress-design-user-guide/Default_CSH.html#/2934.html



For your code, try this:
if(&an_name1 <> '')
&an_namen:=&an_name1
endif()
if(&an_name2 = '')
show(&an_namen)
crlf()
show('2.Zeile' + &an_name2)
endif()
if(&an_name3 = '')
show(&an_namen)
crlf()
show('3.Zeile' + &an_name3)
endif()


As you have recognized, embedded CRLF's are not handled as such and serve as paragraph delimiters. therefore you need to move the line, perform a CRLF, then move the next line as demonstrated above.

SHOW() will move aline of text
CRLF() will force a crlf
If line needs to wrap, then the use of BEGINPARAGRAPH() / ENDPARAGRAPH() is approrpaite

Online help (F1) has more details on these procedures:
http://help.objectiflune.com/en/planetpress-design-user-guide/Default_CSH.html#/3045.html

http://help.objectiflune.com/en/planetpress-design-user-guide/Default_CSH.html#/2939.html

http://help.objectiflune.com/en/planetpress-design-user-guide/Default_CSH.html#/2928.html

Top