Best place to assign CR & Tab

I know I’m doing this wrong. I defined CR as a Method with this code

return chr(13)

But then when I use it, I must reference it as “app.CR” That’s awkward.

I thought it would be best to define CR and Tab as properties but the Default parameter interpreted chr(13) or chr(10) as a literals and not the ascii value. I also tried using the code box of the Property to assign chr(13) to the CR property.

return chr(13) cr=chr(13)
But that did work either.

Something so simple. I’m just missing it.

you realize (or perhaps not). that those are PRE-DEFINED for you?

EndOfLine.Macintosh = Chr(13)
EndOfLine.Unix = Chr(10) // this is the default for macOS and Linux
EndOfLine.Windows = Chr(13)+ Chr(10) // this is the default for Windows

but to answer you question… create a MODULE and place them there… that will make them global and not restricted to a namespce (app)

Or use &u0D for a CR and &u09 for a tab.

I’ve defined them as constants in the past. Only used them when communicating with MCUs projects where ei have to contorl the exact characters. For anything else I use EndOfLine as Dave suggested.

Thanks Dave!

Ken & Langue too. Good to know that I can just type in Hex values like that.

Here’s the code I’m using now.

if targetwindows then return endofline.windows elseif targetlinux then return endofline.unix else //TargetMac return endofline.Macintosh end if

or just

return endofline