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


==$? Search:

In Transient String Words in String Library

Word Name: ==$?
Type: Standard word
Data Stack Signature: -- flag / ss: s1 s2 -- s1 s2
Return Stack Signature: --
Availability: V1.2
Description:

Performs a case-sensitive comparison of the topmost two strings on the string stack, returning true if their length and contents are identical, otherwise returning false. The strings are retained.

Example:

$" Hello" $" Hello" ==$? . \ displays -1 (same)

$" Hello" $" hello" ==$? . \ displays 0 (different)

Comment:

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

A case-insensitive comparison can be constructed as follows:

: same? ( -- flag ) ( ss: s1 s2 -- s1 s2 )
      over$ over$ lcase$ swap$ lcase$ ==$? drop$ drop$ ;

See Also: FINDC$  FIND$ 

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