Strip comments from a string: Difference between revisions

m
Line 617:
NOTES:
 
1. SKIP and SCAN isare not aANS standard functionForth but isare common in most Forth systems as either a library functionfunctions or resident.
 
2. -TRAILING is a resident function in most Forth systems. Shown for clarity.
 
Tested with Swift Forth on OS/X, GForth on Windows
<LANG FORTH>\ Rosetta Code Strip Comment
: LASTCHAR ( addr len -- addr len c) 2DUP + C@ ;
Line 644 ⟶ 645:
1+ ;
 
\ added SKIP to remove leading space characters
: COMMENT-STRIP ( addr len -- addr 'len) -COMMENT -TRAILING 2DUP BL SKIP ;</LANG>
 
Tested at the Forth console
Anonymous user