User Tools

Site Tools


en:pfw:string_handling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:pfw:string_handling [2024-04-17 15:54] – [The idea] willemen:pfw:string_handling [2024-04-17 15:59] (current) – [Generic Forth] willem
Line 10: Line 10:
  
 (We define) A few words that make string manipulation in forth a little smoother.\\ (We define) A few words that make string manipulation in forth a little smoother.\\
-Original idea Albert Nijhof en [[https://home.hccnet.nl/a.w.m.van.der.horst/index.html|Albert van der Horst]]. Examples are:+Original idea Albert Nijhof [[https://home.hccnet.nl/a.w.m.van.der.horst/index.html|Albert van der Horst]]. Examples are:
  
   * Manipulate files   * Manipulate files
Line 26: Line 26:
 {{https://user-images.githubusercontent.com/11397265/142727480-4cb13037-c118-4d05-9eec-529aeaf23cad.jpg| string usage example}} {{https://user-images.githubusercontent.com/11397265/142727480-4cb13037-c118-4d05-9eec-529aeaf23cad.jpg| string usage example}}
  
-However it more useful to use a construct of a cell containing a byte count followed by that many bytes. +
-You should not store a count in a character unless there is a dire need to conserve space. +
-Also a string in Chinese is some of the UTF representation is a sequence,  +
-where an interpretation of a byte is dependant on previous bytes.  +
-The abstraction presented here work equally well on this kind of data structure.+
    
 ===== Pseudo code ===== ===== Pseudo code =====
Line 90: Line 86:
 </code> </code>
  
-The version where the count is stored in a cell is hardly different, but simpler.+Here is a version where the count is stored in a cell, it is hardly different.
 Note that it uses the non Generic Forth word ''%%@+%%'' you can find an implementation example in Note that it uses the non Generic Forth word ''%%@+%%'' you can find an implementation example in
 the [[https://project-forth-works.github.io/well-known-words.txt|well known words]] list. the [[https://project-forth-works.github.io/well-known-words.txt|well known words]] list.
en/pfw/string_handling.1713362040.txt.gz · Last modified: 2024-04-17 15:54 by willem