Anonymous user
Strip comments from a string: Difference between revisions
m
→{{header|Forth}}
Line 613:
=={{header|Forth}}==
Modern Forth advocates the use of stack strings. Stack strings are manipulated as an address and a length on the Forth DATA stack. As such they do not require memory copying for many forms of string functions making them fast. Stack
NOTES:
Line 619:
1. SCAN is not a standard function but is common in most Forth systems as either a library function 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 ▼
▲Tested with Swift Forth on OS/X, GForth on Windows
<LANG FORTH>\ Rosetta Code Strip Comment
: LASTCHAR ( addr len -- addr len c) 2DUP + C@ ;
|