isabbrev

isabbrev <needle> <hay>

Whether one string is a prefix abbreviation of another, ignoring case.

isabbrev is true when needle is a case-insensitive prefix of hay — that is, when typing needle would abbreviate hay. The order matters: the shorter abbreviation comes first. An empty needle never matches, and a null argument is never a match.

Arguments

Returns

A booltrue if needle is a case-insensitive prefix of hay, false otherwise.

Examples

after command (say) {
  do "say isabbrev=[isabbrev 'fo' 'food']."
}

fo is a prefix of food, so [isabbrev ...] is true.

after command (say) {
  require [isabbrev $arg "surrender"]
  emit room "$self lowers its weapons."
}

The guard fires the handler when the actor's whole say argument ($arg) abbreviates surrendersur, surr, or the full word all match — and advances otherwise (see require).

See also