Table of Contents |
/STRING is used to remove or add characters relative to the left end of the character string. Positive values of n will exclude characters from the string while negative values of n will include characters to the left of the string. /STRING is a natural factor of WORD and commonly available.
If c-addr2 lies within the source region (i.e., when c-addr2 is not less than c-addr1 and c-addr2 is less than the quantity c-addr1 u CHARS +), memory propagation occurs.
Typical use: Assume a character string at address 100: ABCD. Then after
100 DUP CHAR+ 3 CMOVE
the string at address 100 is AAAA.
Rationale for CMOVE and CMOVE> follows MOVE.
If c-addr1 lies within the destination region (i.e., when c-addr1 is greater than or equal to c-addr2 and c-addr2 is less than the quantity c-addr1 u CHARS +), memory propagation occurs.
Typical use: Assume a character string at address 100: ABCD. Then after
100 DUP CHAR+ SWAP 3 CMOVE>
the string at address 100 is DDDD.
Existing Forth systems perform string comparison operations using words that differ in spelling, input and output arguments, and case sensitivity. One in widespread use was chosen.
Existing Forth systems perform string searching operations using words that differ in spelling, input and output arguments, and case sensitivity. One in widespread use was chosen.
The current functionality of 6.1.2165 S" may be provided by the following definition:
: S" ( "ccc<quote>" -- ) [CHAR] " PARSE POSTPONE SLITERAL ; IMMEDIATE