Anonymous user
Strip comments from a string: Difference between revisions
m
→{{header|Forth}}
Line 617:
NOTES:
1. SKIP and SCAN
2. -TRAILING is a resident function in most Forth systems. Shown for clarity.
Tested with
<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
|