Skip to content

Instantly share code, notes, and snippets.

@neuro-sys
Created November 26, 2022 10:49
Show Gist options
  • Save neuro-sys/ec5655a153208687e215735ee1b00a73 to your computer and use it in GitHub Desktop.
Save neuro-sys/ec5655a153208687e215735ee1b00a73 to your computer and use it in GitHub Desktop.
: """s s\" \"\"\"s" ;
: s""" ( -- caddr u )
begin
refill 0= if exit then
source """s compare 0= if
refill drop ( ignore the line )
0 c, ( put zero terminator )
exit
then
source s, \n,
again
;
( example )
create sample-string
s"""
This is a
multi line string
"""s
\ Print zero terminated string
: ztype ( addr -- ) begin dup c@ emit 1+ dup c@ 0= until drop ;
sample-string ztype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment