How To

Line break in a string

1

SP4CEBAR 2023-01-24 20:19

NX supports quite a bit of ascii, even line breaks, which can be stored in a variable:

LINE_BREAK$=CHR$(10)
GLOBAL LINE_BREAK$

you can use this line break variable to detect or insert line breaks into string variables

There may be more ASCII tricks like this in NX


SP4CEBAR 2023-01-24 20:30

Here's a list of ascii control codes https://en.m.wikipedia.org/wiki/C0_and_C1_control_codes#Basic_ASCII_control_codes


SP4CEBAR 2023-01-24 20:36

I'm slightly disappointed that CHR$(7) doesn't beep


SP4CEBAR 2023-01-24 21:12

CHR$(34) gives you double quotes, which you can't define like this: """


nathanielbabiak 2023-01-24 22:19 (Edited)

Check out the heading system stuff here for the complete list

https://lowresnx.inutilis.com/topic.php?id=1560


SP4CEBAR 2023-01-25 09:43

Thank you! It's as structured as a textbook
I didn't know that "VAL()" can interpret the C-like "0X" notation as a hex string, that's nice to know


Timo 2023-01-31 13:22

VAL("0X...") exists by accident, I didn't mean to have this feature in LowRes NX. It's just how the internally used C function works. Anyway, I won't remove it.


Timo 2023-01-31 13:23 (Edited)

Ah, there are some custom codes used for the cursor keys, but I think they are only relevant for the INKEY$ function. You cannot print them to move the cursor. I think.


SP4CEBAR 2023-01-31 13:29

you can


SP4CEBAR 2023-01-31 13:30 (Edited)

PRINT "HELLO"+CHR$(10)+"WORLD"

will print

HELLO
WORLD


Timo 2023-01-31 17:22

I mean codes 17, 18, 19, 20
You'll get them from INKEY$ on keyboards with cursor keys (so not on iOS screen keyboard)


SP4CEBAR 2023-01-31 18:32

that's cool I may use that at some point


Log in to reply.