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
<needle>— the abbreviation string (the prefix to test).<hay>— the full string it might abbreviate.
Returns
A bool — true 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 surrender — sur, surr, or the full word all match —
and advances otherwise (see require).
See also
streqi— full case-insensitive equality instead of prefix match.abbrev,hasabbrev— abbreviation against an iterable / iterable.- Strings and interpolation