processessing strings the forth way: on a string stack
Ulrich Hoffmann firstname.lastname@example.org
Version 1.0.3 - 2015-10-07
This package provides an implementation of a string stack to Forth-94 and Forth-2012 systems. It is based on a string stack implementation by Klaus Schliesiek from 1986 but instead of character counted strings it uses cell counts. No interpretation of the strings takes place so it can as well process arbitrary binary data.
To use the string stack, just
INCLUDE stringstack.fs on any standard system. This makes
the string stack definitions available. After loading you still have a standard system.
See the file glossary.md for a description of the defined words.
Here are some examples how to use the string stack:
Put a string on the string stack and print it
" a string" ". a string ok
Do string stack manipulations
" a string" "dup ". ". a string a string ok
" Forth String World!" " Hello, " "join ". Hello, Forth String World! ok
Split a string at a given delimiter, then join the resulting strings using another delimiter
" sing,sang,song" " ," "delimiter-split " - " "delimiter-join ". sing - sang - song ok
Substitute a string within a text by some other string
" name=$(name)" " $(name)" " Forth" "substitute ". name=Forth ok
Please send bug reports, improvements and suggestions to Ulrich Hoffmann <email@example.com>
This program conforms to Forth-94 and Forth-2012
May the Forth be with you!