streqi

streqi <a> <b>

Whether two strings are equal, ignoring case.

Use streqi to compare text without worrying about capitalisation — the common case when matching player input. For an exact, case-sensitive comparison use the eq operator instead.

Arguments

Returns

A booltrue if the two strings are equal ignoring case, false otherwise.

Examples

after command (say) {
  do "say streqi=[streqi 'Foo' 'foo']."
}

Foo and foo differ only in case, so [streqi ...] is true.

after command (say) {
  require [streqi $arg "open sesame"]
  emit room "The wall grinds open."
}

$arg holds the whole say argument as one string; the guard fires the handler only when the actor said exactly open sesame (in any case), and advances otherwise (see require and Handlers for the $arg binding).

See also