Binary strings: Difference between revisions

Line 809:
 
=={{header|Forth}}==
 
\ In Forth, as in Assembler, all strings are binary ie: they are simply bytes in memory
\ Using simple memory operations the programmer can quickly build a string word set.
This code is simple example of how it could be accomplished.
\ The code compiles to only 304 bytes on a 16 bit controller! (with labels stripped out)
\ Adding the 256 byte buffer it takes only 560 bytes, useable in embedded work
 
Obvious enhancements include adding a string stack for
 
<lang forth>\ Rosetta Code Binary Strings Demo in Forth
\ Portions of this code are found at http://forth.sourceforge.net/mirror/toolbelt-ext/index.html
 
\ String words created in this code:
\ In Forth, as in Assembler, all strings are binary ie: they are simply bytes in memory
\ Using simple memory operations the programmer can quickly build a string word set
\ The code compiles to only 304 bytes on a 16 bit controller! (with labels stripped out)
\ Adding the 256 byte buffer it takes only 560 bytes, useable in embedded work
 
\ String words created:
\ STR< STR> STR= COMPARESTR SUBSTR STRPAD CLEARSTR
\ ="" =" STRING: MAXLEN REPLACE-CHAR COPYSTR WRITESTR
Anonymous user