C10: New Line in strings: when to use <13,10> and CHR(13) & CHR(10)?

Please help a confused C10 newbie.

I noticed that MESSAGE interprets the pipe symbol “|” as a CR LF
TIP and report examples accept <13,10>

Visual Basic has a built in constant called vbCrLf which is the equivalent of Clarion’s CHR(13) & CHR(10). Does C10 have anything like that?

Does Clarion do some magic and convert <13,10> to CR LF in all strings, or am I missing something?

I have tried to RTFM but I can’t find anything to clarify the situation, and the CHR function notes don’t give an example.

Pipe symbol is interpreted as CLRF only by MESSAGE function, in other places you can use your own equate like
eq::CLRF EQUATE('<13,10>')

multilineString = 'Line1'& eq::CRLF &'Line2'& eq::CRLF &'Line3'

1 Like

Thanks Mike. I noticed that String Theory also uses <13,10> so I guess its the way to do it. Thanks for the example too.

I really appreciate the time that people take to answer my newbie questions. :smile:

I rarely use CHR().

CHR() can only be used in CODE, while string literals can be used in data/equate declarations AND code.

The “magic” of <13,10> is the brackets. There are other “magic” characters as well.

<13> = <0dh> = CHR(13) = CHR(0dh)

'a{4}'  = 'aaaa'
'xa{5}' = 'xaaaaa'

If you have a string such as ‘<I am cool>’, you can escape the left bracket by doubling it. ‘<<I am cool>’. The compiler is a lot better at ascertaining the intended usage than the old days. Often times you can get by without doubling up.

1 Like

For anyone new, this is a simple example of defining an equate in a global include file so that something like <13,10> never has to be included in ones code.

1 Like

Well, I extended printf function, now it replaces a pipe with CRLFsequence:
multilineString1 = printf('%s|%s|%s', 'Line 1', 'Line 2', 'Line 3')
multilineString2 = printf('Line1|Line2|Line3')

1 Like