<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>


FIND$ Search:

In Transient String Words in String Library

Word Name: FIND$
Type: Standard word
Data Stack Signature: start -- pos|-1 / ss: s1 s2 -- s1 s2
Return Stack Signature: --
Availability: V1.2
Description:

Searches s1, starting from position start, for the first occurrence of the string s2. If the string is found, returns the position of the string relative to the offset, otherwise returns -1.

Example:

$" redgreenbluegreen" $" green" 0 find$ . \ displays 3

Comment:

As a convenience, to make subsequent searches for the same substring easier, both strings are retained on the string stack.

An error occurs if there are less than 2 strings on the string stack.

See Also: FINDC$  REPLACE$ 

<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>