processessing strings the forth way: on a string stack

String Stack

Ulrich Hoffmann

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 for a description of the defined words.

Example usage

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

Join strings

" 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

Bug Reports

Please send bug reports, improvements and suggestions to Ulrich Hoffmann <>


This program conforms to Forth-94 and Forth-2012

May the Forth be with you!